anonymous229901
anonymous229901

Reputation: 11

How do I get a discord bot to add an emoji reaction to a message using discord.py?

I have been trying to get a discord bot that can auto react to messages using default emoji, i keep getting error code 10014: Emoji not found. This is my code:

elif message.content == "test":
    await message.add_reaction(:white_check_mark:)

I am using the discord api, and all other parts of the bot, such as sending and reading messages work fine, but the emojis are the only thing I can't seem to figure out.

Upvotes: 1

Views: 5995

Answers (1)

Tin Nguyen
Tin Nguyen

Reputation: 5330

https://discordpy.readthedocs.io/en/latest/api.html?highlight=reaction#discord.Message.add_reaction

The emoji may be a unicode emoji or a custom guild Emoji.

Unicode Emoji:

await message.add_reaction("✅")

Or through the Emoji object:

https://discordpy.readthedocs.io/en/latest/api.html?highlight=reaction#discord.Client.get_emoji

emoji = client.get_emoji(123456)
await message.add_reaction(emoji)

Upvotes: 2

Related Questions