Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Discord.py 2.0 interactions how to add reaction

@bot.tree.command()
@app_commands.describe(question="Give a title")
async def poll(interaction: discord.Interaction, question: str, choice_a: str = None, choice_b: str = None,
                 choice_c: str = None):
    emb = discord.Embed(title=f"{choice_a}\n{choice_b}\n{choice_c}\n",
                        type="rich")

    message = await interaction.response.send_message(f"**{question}**", embed=emb)

    await message.add_reaction('👍')

Hello this is my code i want to add reaction but this doesn’t working.

Also i tried:

await interaction.add_reaction('👍')
await interaction.message.add_reaction('👍')

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

await interaction.response.send_message() always returns None

You can get around this by using await interaction.channel.send() which returns discord.Message and therefore you are able to add_reaction()

message = await interaction.channel.send(f"**{question}**", embed=emb)

await message.add_reaction('👍')
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading