Im making a discord bot and i decided to change from prefixed commands to slash command using pycord and my poll command it won’t add the reaction it will just send the embed without the reactions
Here is my code:
import discord import datetime from discord.ext import commands class Poll(commands.Cog): def __init__(self, client): self.client = client @discord.slash_command(description = "Create a poll in the current channel") @commands.has_permissions(manage_channels = True) @commands.bot_has_permissions(manage_messages = True) async def poll(self, ctx, *, question): poll = discord.Embed( title = "Poll", description = f"{question}", timestamp = datetime.datetime.utcnow(), colour = 0xeeffee) poll.add_field(name = "Usage:", value = "`✅ Yes | ❎ No`") message = await ctx.respond(embed = poll) await message.add_reaction("✅") await message.add_reaction("❎") def setup(client): client.add_cog(Poll(client))
Before i decided to change to slash commands it worked perfectly fine
I don’t know what is the problem and i can’t find a solutions if it’s something simple pls tell because i can’t make it work
Advertisement
Answer
message = await ctx.respond(embed=poll) msg = await message.original_response() await msg.add_reaction("✅") await msg.add_reaction("❎")
https://docs.pycord.dev/en/stable/api.html#discord.Interaction.original_response