Skip to content
Advertisement

In which way can I make an Auto-React feature for a discord bot that I’m writing in the discord.py API?

Basically, I’d like my discord bot to react with an emote to messages that have keywords in them. I tried tutorials, using if-statements, and both of those didn’t work.

JavaScript

Advertisement

Answer

This is a simple function, if you want it to use a random emoji from the server, you would have to get the emoji id, but you can do this.

JavaScript

This will match any message that only says “react to me”

EDIT:

This method can not use default emojis (thumbs up for example), it uses customs emojis in the server, you can use :put the name of the emoji in between these signs: to get something like this <:name:id>

Example: enter image description here

so the id for the emoji (what you will be putting inside the add_reaction() is the 672251623422296117 only.

If you want to use universal emojis (default), you have to find the unicode of it and put it in as a string (inside “”). Example: the unicode for 🏓 is U0001F3D3, so you will put that inside the function.

Here is where you can find the unicode for the default emojis: https://emojipedia.org/unicode-9.0/

It will look like this enter image description here

Which means that the unicode for that emoji is U0001F923 (replace U+ with U000, making it U+1F923 = U0001F923)

add await client.process_commands(message) at the end of the function to allow other functions to work

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement