discord

Give and remove roles with a bot, Discord.py

元气小坏坏 提交于 2020-06-01 05:53:10
问题 How do I make a bot in Discord.py that will assign roles present in a role.json file, while using the same command to both remove and add the same role. For example, ?role <rolename> will both add and remove a role, depending on if the user has the role assigned. I'm a bit confused on how to achieve this. My current bot uses ?roleadd <rolename> ?roleremove <rolename> . 回答1: I'm not sure where your role.json file comes into play, but here's how I would implement such a command @bot.command

How do I make a discord bot respond only to people with a certain role? [C#]

和自甴很熟 提交于 2020-06-01 05:08:00
问题 I want to make my discord bot respond exclusively to people with a @Member role, so when a person without that role writes a command (ex. >say Hello), the bot will not respond to it, but when a person with the @Member role writes that, it will. 回答1: Ideally, if this is being used for a command or rather multiple commands, a precondition should be used (example administration commands). This allows you to not have to duplicate the checks within each command. Ah example of such a precondition

How do I make a discord bot respond only to people with a certain role? [C#]

情到浓时终转凉″ 提交于 2020-06-01 05:07:13
问题 I want to make my discord bot respond exclusively to people with a @Member role, so when a person without that role writes a command (ex. >say Hello), the bot will not respond to it, but when a person with the @Member role writes that, it will. 回答1: Ideally, if this is being used for a command or rather multiple commands, a precondition should be used (example administration commands). This allows you to not have to duplicate the checks within each command. Ah example of such a precondition

Discord.js — How to read all users in a voice channel and send a private message to each of them containing a random role

和自甴很熟 提交于 2020-06-01 04:38:41
问题 I want to make a Wolves/Mafia-esque game on my server. When I write the command !role 1wolf 2villagers , I would like to randomly distribute the specified roles by private message (so 1 person receives the wolf role and 2 people receive the villager role) to all the people in a specified voice channel. The roles are not literal guild roles but simply a message. 回答1: You can do it easily: client.on('message', (message) => { if(message.content.startsWith('!role')){ let channelID = 'your voice

Discord.js — How to read all users in a voice channel and send a private message to each of them containing a random role

你说的曾经没有我的故事 提交于 2020-06-01 04:38:25
问题 I want to make a Wolves/Mafia-esque game on my server. When I write the command !role 1wolf 2villagers , I would like to randomly distribute the specified roles by private message (so 1 person receives the wolf role and 2 people receive the villager role) to all the people in a specified voice channel. The roles are not literal guild roles but simply a message. 回答1: You can do it easily: client.on('message', (message) => { if(message.content.startsWith('!role')){ let channelID = 'your voice

Discord JS - How to react multiple times to the same embed?

大城市里の小女人 提交于 2020-05-31 06:04:20
问题 I've only gotten the first "moneybag" emoji to react to the newest message in the channel, which is the embed that the bot sends, however, I want the bot to react to the new embed with both the "money bag" and "ticket" emojis and so far it will react with the "money bag" emoji but, errors out when it tries to react with the "ticket" emoji. How do I get the bot to react to the new embed with both emojis? if (message.content === '-new') { const filter = (reaction, user) => { return ['💰', '🎟']

How a discord bot can join a voice channel in discord rewrite?

匆匆过客 提交于 2020-05-30 07:52:19
问题 I want to make my discord bot to connect to the voice channel I am when I type !join . i have tried to do it with the following code but i got this error: bot: BotInstance of 'Bot' has no 'voice_client_int' memberpylint(no-member) i found that my code is not compatible with the rewrite discord version. @bot.command(pass_context = True) async def join(ctx): channel = ctx.message.author.voice.voice_channel await bot.join_voice_channel(channel) @bot.command(pass_context = True) async def leave

Discord bot sends 2 messages instead of 1

时光毁灭记忆、已成空白 提交于 2020-05-17 07:01:07
问题 My bot is sending the same message twice, in response to my command. Please help me, I don't know what to do with this problem import discord from discord.ext import commands from discord.ext.commands import Bot import youtube_dl Bot = commands.Bot(command_prefix= '$') Bot.remove_command('help') @Bot.command() async def hello(ctx): author = ctx.message.author await ctx.send(f"Hello {author.mention}") @Bot.command() @commands.has_permissions(administrator= True) async def mute(ctx, member:

My discord.py bot with chat-filter event sends 2 or more messages instead of 1

左心房为你撑大大i 提交于 2020-05-17 06:16:04
问题 Not so long ago added in my discord bot chat-filter ,which delete messages which i dont want to see.But i have a problem with this.Before this new event my bot sends on the command $hello 1 message(hello,{me}),but with this chat filter he sends 2 or more questions(Number of posts = number of banned words).Can u heip me with this. @Bot.event async def on_message( message ): filter = ['!leave', '!play','!skip'] for word in filter: if word in message.content: print('%s bad word' % (message

Discord Oauth2 receiving 'invalid client' error

白昼怎懂夜的黑 提交于 2020-05-17 06:11:33
问题 I had Discord Oauth2 implemented so that my users could log into my website by authenticating through Discord. For months, everything worked great and now all of the sudden it stopped working. Per Discord's oauth2 instructions,https://discordapp.com/developers/docs/topics/oauth2#shared-resources, I am able to successfully acquire the access code that is meant to be traded for the access token. However, when I try to receive the access token I receive an 'invalid_client' error. First, I am