user13878676
user13878676

Reputation:

How to make an event to give reactions in discord.py?

I am trying to create an event, which will be triggered when someone sends a message in a specific channel. In that message if the user mentions 4 users the bot would give a reaction onto his message.

I know I can give reaction with

await ctx.message.add_reaction(emoji="<a:tick:748476262640779276>")

but I don't understand how can I create this kind of event. What function should I use?

Upvotes: 0

Views: 274

Answers (1)

Abdulaziz
Abdulaziz

Reputation: 3426

You can make an on_message event and message.mentions which will give you a list of members mentioned. you can just take the length of it.

@bot.event
async def on_message(message):
    if len(message.mentions) >= 4 and message.channel.id == 123456789:
        await message.add_reaction(emoji="<a:tick:748476262640779276>")

    await bot.process_commands(message) # to allow commands

Upvotes: 1

Related Questions