I started to experiment with things that required my bot to have certain permissions. I didn't know how to actually assign these permissions through JS. Does anyone have any ideas? (I also heard the permissions would also make a custom role for the bot)
Thanks.
You cannot assign permissions to a bot in the guild. They must be willingly given to the bot through the invite scopes of the person who invited it.
And yes, the permissions will give the bot a role in the server, so it can define if you can do something to a user with a higher role.
Im assuming you did these if you already have your bot on a server, but ill explain.
You go to the OAuth2 URL Generator, and put your client ID (I hope you already know how to get that.) You then select the bot scope(and any other scopes you would like...), then scroll down to the permissions section, and select the permission your bot needs. The user has the right to remove these permission, and then you can't really do anything, and hope they know the bot cant do the command then without it.
Then copy the link back up in the Appliction Info area, so you can paste it, and get your bot on a server!
That was alot, hope this helps at all.
Go to oauth generate a URL for
Scroll to the bottom in Bot Permission select permissions needed by the bot, and kaboom its done :D
Copy the URL add the bot to your server :D
Related
Using a user token, how can I have the user leave a Discord server? I wanted to make a website where you put your user token and it will leave discord server.
As per discord terms of service the use of "self bots" is not allowed
A "self bot" is when a normal discord user account is automated in some way, for example leaving all servers or automatically sending messages.
Another reason why this is not recommended is the security concern, how does the user know that your website won't steal their token and "hack" their account?
Saying that there is of course a way to do it neglecting terms of service and user safety. A starting point would be the discord API or a discord library like discord.js. I won't spoon-feed you code, do some research your self and if you encounter a more specific problem come back and ask.
I'm using discord.js and I would like to analyze messages of a DM dicussion using a bot.
I have a simple question, is there a way to reach data of a DM discussion with someone using a bot(giving at the bot the permission to reach the messages).
I'm not sure if this is possible or not, I was thinking at something like a getMessageById or similar, but it's obvious that this would be a massive privacy problem of the message.
Let me know if is there a way, but I'm quite sure that there isn't one.
Thank you, have a great day.
Bots can only check the dm between themselves and the user. No dms between two users ofc.
Self bots would be able to but discord patched em I believe.
In an effort to provide regression testing for my pre-existing bot on Discord, I'm trying to create another bot that sends timed messages in order to test the original bot.
For example, I would type "!test" into Discord, and the Testing Bot would send "?start" into the chat. This should trigger the Original Bot and have it reply to the Testing Bot.
Unfortunately, my Original Bot was created using Discord-Commando. Although normal Discord.js allows for replies to bots (and even itself as far as I've discovered), Discord-Commando.js does not. At least, as far as my initial findings go.
I've scoured Google and Discord-Commando's documentation for examples of interactions between bots using Commando, but I couldn't find anything.
At most, I found that there is indeed a boolean flag in a bot's User object that identifies it as a bot (i.e. it has a boolean saying "bot: true") but that's about it. When trying to use methods in the Command object, none of them seem to trigger when the bot is given a command from another bot.
My ultimate question is that - is there a method that I could override that would allow my bots to essentially "talk" to each other while still using Discord-Commando? And if not, are there any recommendations on how to automate testing a Discord bot?
I am currently working on a discord bot (using the discord.js library). This bot uses steam integration to get a user's inventory. Is there a way to check if the person has steam connected to their account and get their steam account ID? If not, how should I make sure people can link their steam account to my bot?
I think you might search for this specific documentation/implementation (User -> UserProfile -> UserConnection), but I wouldn't recommend using it, since it is really instable and you can only use it as a normal user not as a bot.
I would rather think about implementing a link system on your own, where user can try to link their accounts and mods must approve those linkings.
The Discord API does not support this through Bot Accounts as far as I'm aware. As noted previously it's only possible using User accounts, though automating user accounts is against the Discord Terms Of Service and the Discord API Terms so I wouldn't recommend it.
Hey I'm trying to make a bot that will check user's connected battle.net account and load game rank. I'm using discord.js library and trying to acccess UserProfile via bot, which isn't allowed since you can't .fetchProfile(). Based on discord.js I'm only allowed to check UserProfile and then connections this way.
My question is: is there any way for bot to load user's connected accounts ? I only need battle.net tag that user verified and connected to discord account.
User: https://discord.js.org/#/docs/main/stable/class/User
UserProfile: https://discord.js.org/#/docs/main/stable/class/UserProfile
Thanks a lot !
Unfortunately this is not possible when using a "real" bot account, however it is possible if you're using a user bot account.
I'd suggest a workaround of using OAuth2. You could have users authenticate your bot with OAuth2, and then fetch their connections this way. Some more information at https://discordapp.com/developers/docs/topics/oauth2
I think I might have a way to get close to that. It took me a while, but I think I've figured out how you can check if someone (in my case, just the bot itself) is playing a certain game. You could probably replace client.user with the user you want to check. Here's the code:
if (client.user.presence.game.name == "INSERT GAME TO LOOK FOR HERE") {
ACTION TO BE CARRIED OUT
}