Reputation: 55
I'm facing problems trying to add a reaction to the bot's response when it responds to a slash command I entered.
@bot.slash_command(name='test', description="Test.")
async def test(ctx):
msg = await ctx.send("Hello.")
await msg.add_reaction('🤖')
As you can see it's supposed to add a reaction to it's own message. But I get this error:
nextcord.errors.ApplicationInvokeError: Command raised an exception: AttributeError: 'PartialInteractionMessage' object has no attribute 'add_reaction'
Please tell me how do I add a reaction to a slash command.
Upvotes: 2
Views: 1006
Reputation: 1516
As per the error, ctx.send
is returning a PartialInteractionMessage
. From the docs:
This does not support most attributes and methods of
nextcord.Message
. Thefetch()
method can be used to retrieve the fullInteractionMessage
object.
@bot.slash_command(name='test', description="Test.")
async def test(ctx):
msg = await ctx.send("Hello.")
full_msg = await msg.fetch()
await full_msg.add_reaction('🤖')
Upvotes: 3