Skel
Skel

Reputation: 43

Discord.py react to bot own messages

I am trying to react to my bot own messages. But it does not work.

    if args[0] == "solido":
        reaction = "👍"
        sent = await ctx.message.channel.send(client.get_channel("795387716967333889"), embed=embed)
       # await message.add_reaction(sent, emoji = "\U0001F44D")
        await ctx.message.add_reaction(reaction)

if I use this type of code, the bot will react to MY message commands. But if i dont use the ctx method the bot will give me this error: NameError: name 'message' is not defined

How could I fix?

Upvotes: 0

Views: 96

Answers (1)

Maxsc
Maxsc

Reputation: 229

using await sent.add_reaction(reaction) instead of await ctx.message.add_reaction(reaction) should work

Upvotes: 1

Related Questions