I can't add reactions to a message in discord.py

0

Title. Here is my current code:

@client.event
async def on_message(message):
    emoji = client.get_emoji(765173945056886814)
    if message.author.id == 236199051505303552:
        await message.add_reaction(emoji)

And the error i am getting is

line 1082, in _emoji_reaction
    raise InvalidArgument('emoji argument must be str, Emoji, or Reaction not {.__class__.__name__}.'.format(emoji))
discord.errors.InvalidArgument: emoji argument must be str, Emoji, or Reaction not NoneType.
We have logged in as Zinthium#3381
The program 'python.exe' has exited with code -1 (0xffffffff).
python
discord.py
asked on Stack Overflow Oct 12, 2020 by Yusuf Ziya

2 Answers

0

get the emoji code yourself on discord. by typing \emoji. \is basically the escape character in discord. emoji codes look like these <:klol:716218157060325387>

@client.event
async def on_message(message):
    if message.author.id == 236199051505303552:
        await message.add_reaction("emoji code")

Your code should actually work. I think the bot doesn't have access to that emoji. Maybe it is not in the server. So it returns None

answered on Stack Overflow Oct 12, 2020 by Aneesh YR
0

This

    emoji = ':woo:765172185995411456'

seems to have worked, i just need to label the emojis i'll use like emoji1, emoji2 and such, or emojiWoo.

answered on Stack Overflow Oct 12, 2020 by Yusuf Ziya

User contributions licensed under CC BY-SA 3.0