Unable to fetch message that triggered interaction
Summary
Unable to fetch message that triggered interaction
Reproduction Steps
- Create slash command
- Attempt to resolve the trigger message by awaiting
Interaction#original_message - Error is produced
Minimal Reproducible Code
@commands.slash_command()
async def ping(inter: disnake.ApplicationCommandInteraction):
msg = await inter.original_message()
print(msg.author.id)
Expected Results
Interaction#original_message to resolve as an instance of InteractionMessage
Actual Results
The following error is produced even if the message still exists:
disnake.errors.NotFound: 404 Not Found (error code: 10015): Unknown Webhook
Traceback:
bot_1 | Traceback (most recent call last):
bot_1 | File "/usr/local/lib/python3.9/site-packages/disnake/ext/commands/slash_core.py", line 482, in invoke
bot_1 | await self(inter, **kwargs)
bot_1 | File "/usr/local/lib/python3.9/site-packages/disnake/ext/commands/base_core.py", line 145, in __call__
bot_1 | return await self.callback(self.cog, interaction, *args, **kwargs)
bot_1 | File "/app/cmds/eval.py", line 19, in eval
bot_1 | msg = await inter.original_message()
bot_1 | File "/usr/local/lib/python3.9/site-packages/disnake/interactions/base.py", line 264, in original_message
bot_1 | data = await adapter.get_original_interaction_response(
bot_1 | File "/usr/local/lib/python3.9/site-packages/disnake/webhook/async_.py", line 189, in request
bot_1 | raise NotFound(response, data)
bot_1 | disnake.errors.NotFound: 404 Not Found (error code: 10015): Unknown Webhook
bot_1 |
bot_1 | The above exception was the direct cause of the following exception:
bot_1 |
bot_1 | Traceback (most recent call last):
bot_1 | File "/usr/local/lib/python3.9/site-packages/disnake/ext/commands/bot.py", line 1887, in process_application_commands
bot_1 | await app_command.invoke(interaction)
bot_1 | File "/usr/local/lib/python3.9/site-packages/disnake/ext/commands/slash_core.py", line 491, in invoke
bot_1 | raise CommandInvokeError(exc) from exc
bot_1 | disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: NotFound: 404 Not Found (error code: 10015): Unknown Webhook
Intents
Default + Members
System Information
- Python v3.9.7-final
- disnake v2.1.2-alpha
- disnake pkg_resources: v2.1.2
- aiohttp v3.7.4.post0
- system info: Linux 5.10.47-linuxkit #1 SMP PREEMPT Sat Jul 3 21:50:16 UTC 2021
Running in a Docker container based on python:3.9-slim-buster
Checklist
- [X] I have searched the open issues for duplicates.
- [X] I have shown the entire traceback, if possible.
- [X] I have removed my token from display, if visible.
Additional Context
No response
Interaction.original_message returns the message which has already been sent using the interaction webhook (check Interaction.response). You are not sending any message, that is the reason.
I'm gonna keep this open because we should seriously not have such an arbitrary error for this. Gonna need to do something similar to the error message about not deferring.
The documentation states
If the interaction response was InteractionResponse.send_message() then this would return the message that was sent using that response. Otherwise, this would return the message that triggered the interaction.
Would this not fall under the latter?
@EQUENOS you might want to check this? I don't remember this ever being a thing.
I don't think that InteractionResponse.send_message() should return the message object
@EQUENOS - I should probably clarify that that documentation quote (and this issue as a whole) is referencing Interaction.original_message(), not InteractionResponse.send_message().
We will clarify the documentation, this issue can be closed.