Answer the question
In order to leave comments, you need to log in
How to find out all users who have reacted to a selected message in discord.py?
Hello! I create a function for the bot that collects participants and forwards them to the server.
(The code)
@bot.command()
async def start(ctx):
channel = ctx.message.channel
mess = await channel.send('Набор в игру')
ID = mess.id
r = bot.Reaction
await asyncio.sleep(10)
mess = await channel.fetch_message(ID)
Answer the question
In order to leave comments, you need to log in
The attribute you want is called Message.reactions
. discord.Reaction
- the type of objects returned in reactions.
discord.Message.reactions
@bot.command()
async def start(ctx):
mess = await channel.send('Набор в игру')
await asyncio.sleep(10)
mess = await ctx.channel.fetch_message(mess.id)
if yes_react := discord.utils.get(mess.reactions, emoji=ctx.guild.get_emoji(471483388532742130)):
async for user in yes_react.users:
print(str(user)) # выведет всех пользователей поставивших реакцию в консоль
Perhaps the corgi option does not suit you, but still:
@commands.Cog.listener()
async def on_raw_reaction_add(self, payload):
members_list = []
if payload.message_id == 745708593348739214:
if payload.emoji.name == '': #эмоция которую нужно поставить
guild = self.bot.get_guild(payload.guild_id)
member = guild.get_member(payload.user_id)
members_list.append(f'{member}')
#и делаешь что-то
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question