Interactive commands discord.js v12 - javascript

I have a bot that logs when invites are being created and the standard channel where the logs are going are only going to appear in the server / channel ID I placed there. I want to be able to change this per server it is in.
Output (What I am trying to achieve)
User: !log channel (CHANNEL ID)
Bot: New log channel set. (The logs will now log into the channel ID set, since the bot will be in a numerous amount of servers, I want it to only take affect if the channel ID matches the guild the command is being invoked in)
I want Server Owners and Administrators to be able to change the channel ID without accessing the VSC, how would I make it so anyone can change it outside of the VSC.
Notice: I want to be able to use this information and knowledge for another commands and features I am developing. If anyone knows a correct term for what I am trying to do here please let me know and I appreciate all the help. (I'm just looking for a term or a reference on how to do things like this, I'm not asking for the code)

While you can use classic message arguments as pointed out in the comments, I suggest you to use Discord's new slash commands feature. They allow for tight integration with Discord's clients and provides a much nicer user experience (autocomplete helps users with arguments).
However, discord.js v12 does not officially support slash commands (v13 does). You could:
use an external library: /create or
install v13-dev or
wait until v13 is released (not really suitable).
Edit: v13 has been released, and slash commands are now heavily recommended, with Discord now requiring verified bots to use them.

Related

Add a bot using a bot discord.js

I wanted to know if it was possible if you could use a bot to add another bot to the current server. Of course the bot would need permissions in the server, but is it possible? Is there a certain code that could be used?
Discord Bots are similar to user accounts in quiet a lot of ways however, bots cannot add other bots to a server.
This is mainly due to security and the fact that Discord wants the server admins to have full control over the server.

Use your bot as a normal user

I've seen someone around using their bot to reply inside a server as if the bot was just a normal user, i tried to look for something similar and the only thing i found is this:
https://github.com/ZomoXYZ/Discord-Bot-Client
Which is like having a separate client to use for your bot. I would like to know if we could just skip all that stuff and implement it in our own bot instead of using that as a secondary discord client.
Any suggestion or someone who achieved this and wanna share it or send it privately i'll be thankful.
EDIT: i'm sorry for the confusion but what i'm looking for is not a selfbot it is a way on using your own normal discord bot to be able to text and the example of that discord bot client is fairly what i'm trying to achieve. so let's say you made a new bot and invited it to your server, implementing a code where that bot is able to be used as a normal user-account and not a selfbot when you're using your own account.
After digging around, I think I have a good answer to your updated question. No, it is not against ToS as far as I have seen. I scrolled through dozens of articles that have said the same thing. It isn't against ToS directly (no, it doesn't fall under the self-bot category), but it is kind of on the edge. They don't say anywhere that you can't do it, and honestly it's not that different from using an eval command to send a message to a channel, except it is easier and looks better. Also there is also no reason as to why they should block it in the future. While with a self bot you can login and spam messages or dm advertise a bunch of members automatically, logging in to a bot account gives you a higher ratelimit for the same features you would get by just joining the server with your normal account. As for permissions, you can't do any more than you could by coding it, and the server admin that invited the bot gave it the permissions that it has. You aren't magically getting more of anything out of using a client such as Discord-Bot-Client or LiveBot. It just gives a better ui experience than using code to do the same thing. Sorry I'm late on this answer but I hope it helps anyone who clicks on this and sees it.
TL;DR: They didn't say its against ToS, and there isn't any reason it should be.
Note, this no longer works due to Discord.js API updates. I no longer use Discord.js, so I cannot tell you how to make a self bot. However; what lies below may still help you, but no longer is the answer.
-=-=-=-=-=-=-=-
Self Bots are NOT allowed.
(Link)
Self bot's used to be used and was just ignored by Discord but in the last year they've decided to enforce it. You may get your account banned by doing this. Just make and use a normal bot: https://discordapp.com/developers/applications/
How todo it anyways.
When you make your bot somewhere you need a bot.login(<key>) You just need to find YOUR key to have it run as a selfbot.
Note: this works on both the WEB version & the downloadable app.
Step 1:
Login into discord, navigate to a TextChannel so you can send a message. Open the CONSOLE by either CTRL-SHIFT-I for windows, and I assume but am not sure CMD-SHIFT-I for mac.
Head into the NETWORK tab. So you should see somthing like:
Step 2:
Click on the Ø (Circle w/ slash) to easier find what we're going todo next.
After you've cleared the network tab send a messaage into your channel and you should see 2 or more items pop up in the network tab, click on the first one that should say messages as it's name.
Step 3:
When you click on the messages item, you should open another tab inside the network tab Click on the HEADERS tab inside the new tab
After that scroll down until you reach "Request Headers" section. Under that section grab the "Authorization" Value
That value is what you use in your bot.login(<key>)
I can't guarantee this will work, as I haven't tried it recently, but this is what I know from doing it in the past and from what I know from other's expierences.

Discord bot is running two instances, and I can't find one of them to turn it off

I made a simple Discord response bot that's hosted on glitch.com. My problem is that whenever I make a change (such as to add a new response) and run the app via the console, the instance of the bot that was already running doesn't turn off. This makes the bot post responses that were already in the previous version twice.
How can I find the instance of the bot that's already running and turn it off? It doesn't show up in glitch's logs. Thanks in advance!
This is not a thing related with Discord.js
You can try shutting it down with eval command if you have one.
Also the bot won’t turn off if you run another instance, This is similar to how user accounts works. You can have your account running at the same time at both your phone and pc or two different browser tabs at the same time..
User accounts also has tokens.
And if Glitch has automated-deploys feature, you don't need to run another instance everytime.
You can simply regenerate your bot's token to make it sign off.

Creating multiple Microsoft Bot instances, polling them for availability, using DirectLine API, .Net and JS?

We've developed a bot for our website which is used as a sort of messenger, the user selects if they want to speak to our support or chat team and it routes them to the correct team. The chat escalation and chat service is provided by Live Assist.
After developing the bot locally, all seemed to work fine, however once we launched it live, we discovered that the bot is only allowed one conversation at a time through Live Assist. What happens is anyone who opens the chat, no matter which device, is apart of the same single instance conversation. We contacted Live Assist and they said we require multiple bots to handle multiple chat instances. They did link us to a few of their online resources but they did not provide any advice for this particular problem (which we assume is a common one?)
I've been scratching my head at how something like this could be implemented, we are able to host multiple bots on Azure but I am stumped at finding a way to cleanly poll a bot to see if a conversation is in progress without interrupting that particular conversation. The only resource found which may assist is here however it is in node.js, whereas our solution is JavaScript on the front end and the bot code is C# .Net.
Any guidance would be greatly appreciated. Many thanks.
Edit: To clarify, we are wondering if what we want is possible, if it is possible to have multiple azure bot framework instances and reach them all through javascript on a webpage, poll if a chat is active, and then use a free bot for the user.
In bot framework, there is no built-in feature to accomplish this since natively bot framework supports multiple concurrent conversations across all channels. As a workaround for the limitation of Live Assist let me share one idea I have.
You could in some sort of data store have a time that resets everytime a message is sent/received and once that timer expires that would qualify the bot as "not in a conversation". In this scenario when your webpage loads, it would ping your datastore to see which bot was available and if one is available, return the direct line secret token for the available bot. This would cause your front end to load up the chat for the correct bot. I do not have an implementation to share because I have never seen a scenario like this, but I hope this helps.

Skype Bot Authentication

So recently, I set up a NodeJS bot to link messages between a Discord chat and a Skype chat. Now, I'm pretty new to Javascript, and entirely new to NodeJS, so luckily for me, there's a framework already made called Spype. The discord side works by using Discord's bot API, so that side works totally fine. The Skype side, on the other hand, uses Skyweb to connect to the Skype web client. Now, that's all well and good, except that it uses actual Skype accounts to log in, and you can no longer create actual Skype accounts, only Microsoft accounts. (Those are the ones that start with "live:".) The problem is that apparently, these two account types use different login methods. Now, try as I might, I have not been able to get the REST stuff to work for the Microsoft account login. This is probably due to my lack of expertise in that area.
So either I need to get Skyweb to log in to Microsoft accounts (this is probably the easiest option, I feel like it should be easy, I just can't get it), or change the bot to use a totally different authentication system.
I really hope someone can help with this. Let me know if I left out any information.
Skyweb has been updated, the issue has been fixed.

Categories