Reputation:
I want to do a suggestion command. The command is working. The command send an embed into a specific channel named "suggestions". I want to add reactions to the embed (❌ and ✅). Now I need your help. I am not able to add reactions to the embed. This is my actual code, without adding reactions:
@bot.command()
async def suggestion(ctx, *, content: str):
title, description= content.split('/')
embed = discord.Embed(title=title, description=description, color=0x00ff40)
channel = bot.get_channel(857413508224385054)
await channel.send(embed=embed)
await ctx.send("your suggestion is send!")
await ctx.message.delete()
Upvotes: 0
Views: 589
Reputation: 3602
You need to define the embed in order to add reactions.
Simply do:
@bot.command()
async def suggestion(ctx, *, content: str):
title, description= content.split('/')
embed = discord.Embed(title=title, description=description, color=0x00ff40)
channel = bot.get_channel(857413508224385054)
test = await channel.send(embed=embed) # Define the message
await test.add_reaction("✅") # Add reactions
await test.add_reaction("❌")
await ctx.send("your suggestion is send!")
await ctx.message.delete()
Another way could be to set up an event that listens for messages in the channel:
@bot.event
async def on_message(message):
if message.channel.id == 857413508224385054: # Checks if the channel is correct
await message.add_reaction("✅") # Adds the reaction to all new messages
await message.add_reaction("❌")
Upvotes: 0