discord.py-rewrite

How do you have a Discord bot remove a user reaction to a message in discord.py?

被刻印的时光 ゝ 提交于 2021-01-05 09:14:05
问题 I'm using an @client.event and using async def on_raw_reaction_add(payload): to read Discord reaction events. I need to be able to delete a user reaction when they fail one of the flags in my code. I saw in the documentation that there is await remove(user) but I don't think I'm using it right. Any suggestions? 回答1: You can use either Message.remove_reaction or Reaction.remove. A Reaction object represents a specific emoji reaction to a Message, so if the Reaction object you have is not for

discord.py rewrite | How to wait for author message?

佐手、 提交于 2020-12-30 03:23:06
问题 I am making a command which waits for a user to reply to the bot, but I would like the bot to only accept the author's reply. @client.command(name='numgame', brief='Guess a number between 1 and 100', pass_context=True) async def numgame(context): number = random.randint(1,100) guess = 4 while guess != 0: await context.send('Pick a number between 1 and 100') msg = await client.wait_for('message', check=check, timeout=30) attempt = int(msg.content) if attempt > number: await context.send(str

How to make a weather command using discord.py v1.4.1

橙三吉。 提交于 2020-12-30 02:41:48
问题 In case you would like to make a weather command using discord.py and have a cool addition to your bot, I got you covered, I have answered below on how to create a weather command in discord.py. 回答1: We will be making a command which will work like this - Starting off, we are going to be using openweahtermap API, which requires an API key, you can get one for free by simple logging in to their website. Once you have got the API key, you are all good to go. The second step will be to start

How to make a weather command using discord.py v1.4.1

北慕城南 提交于 2020-12-30 02:38:45
问题 In case you would like to make a weather command using discord.py and have a cool addition to your bot, I got you covered, I have answered below on how to create a weather command in discord.py. 回答1: We will be making a command which will work like this - Starting off, we are going to be using openweahtermap API, which requires an API key, you can get one for free by simple logging in to their website. Once you have got the API key, you are all good to go. The second step will be to start

How to make a weather command using discord.py v1.4.1

半腔热情 提交于 2020-12-30 02:38:27
问题 In case you would like to make a weather command using discord.py and have a cool addition to your bot, I got you covered, I have answered below on how to create a weather command in discord.py. 回答1: We will be making a command which will work like this - Starting off, we are going to be using openweahtermap API, which requires an API key, you can get one for free by simple logging in to their website. Once you have got the API key, you are all good to go. The second step will be to start

How to make a weather command using discord.py v1.4.1

老子叫甜甜 提交于 2020-12-30 02:38:06
问题 In case you would like to make a weather command using discord.py and have a cool addition to your bot, I got you covered, I have answered below on how to create a weather command in discord.py. 回答1: We will be making a command which will work like this - Starting off, we are going to be using openweahtermap API, which requires an API key, you can get one for free by simple logging in to their website. Once you have got the API key, you are all good to go. The second step will be to start

Discord.py rewrite get_member() function returning None for all users except bot

谁说我不能喝 提交于 2020-12-27 06:14:27
问题 I made a stupid discord bot a few months ago to change my friends name every minute, but I updated it today and now the get_member function is returning none. @client.event async def on_ready(): print('bot is ready!') status = discord.Activity(name="Sam be a loser", type=discord.ActivityType.watching) await client.change_presence(activity=status) name_change.start() @tasks.loop(minutes=1) async def name_change(): server = client.get_guild(id=584112137132048387) user = server.get_member

Discord.py rewrite get_member() function returning None for all users except bot

不想你离开。 提交于 2020-12-27 06:11:50
问题 I made a stupid discord bot a few months ago to change my friends name every minute, but I updated it today and now the get_member function is returning none. @client.event async def on_ready(): print('bot is ready!') status = discord.Activity(name="Sam be a loser", type=discord.ActivityType.watching) await client.change_presence(activity=status) name_change.start() @tasks.loop(minutes=1) async def name_change(): server = client.get_guild(id=584112137132048387) user = server.get_member

Discord.py rewrite get_member() function returning None for all users except bot

狂风中的少年 提交于 2020-12-27 06:11:13
问题 I made a stupid discord bot a few months ago to change my friends name every minute, but I updated it today and now the get_member function is returning none. @client.event async def on_ready(): print('bot is ready!') status = discord.Activity(name="Sam be a loser", type=discord.ActivityType.watching) await client.change_presence(activity=status) name_change.start() @tasks.loop(minutes=1) async def name_change(): server = client.get_guild(id=584112137132048387) user = server.get_member

discord.py rewrite | Allow only one instance of a command

纵然是瞬间 提交于 2020-12-16 04:19:11
问题 Whilst using my bot, I discovered that multiple people can use the same command simultaneously. I would only like the command to be ran one at a time, due to it's nature. Is there a way to ensure there is only one instance of the command running? If there is, please tell me. I need this fixed sort of quickly, so any help is appreciated. 回答1: You can have a cooldown for all users with some large timeout, then reset the cooldown at the end of the command: from discord.ext.commands import