#Hello, how to detect if a interaction was Unknown (for example an Event)
1 messages · Page 1 of 1 (latest)
wdym
the red error text?
is there an event that detects unknown interactions
No method to respond with error message ?
no such event exists, no
what's the root issue? might be better to try address that instead
I don't know, from time to time my button/slash command crashes for unknown interaction
when sending the return message
if it's the random ones you see in console then you'd best ignore it
but if you have a proper traceback and it shows it erroring somewhere in your command that should be fixable
at the line where he responds
is it possible your command can take longer than 3 seconds to respond?
No because I have a defer
could you perhaps show the code and paste the full error?
if you do get one feel free to tag me here with it
ok
you could do:
async def on_application_command_error(
self, ctx: discord.ApplicationContext, exception
) -> None:
if (
isinstance(exception, discord.ApplicationCommandError)
and exception.original.code == 10062
):
print("Unknown interaction") #...
that... isn't really going to help anything, unknown interaction is generally a symptom of deeper errors in your code
yeah ik ik
I honestly added this only because the bot when chunking was responding too long haha
in a slightly different version but was based on kind of a status checker field
ah yeah, during on ready it can't recieve anything either
but as you say, in other cases it means that probably something is too time-consuming without deferring ;p
Traceback (most recent call last):
File "/home/container/.local/lib/python3.10/site-packages/discord/client.py", line 378, in _run_event
await coro(*args, **kwargs)
File "/home/container/cogs/cooldown.py", line 21, in on_application_command_error
raise error
File "/home/container/.local/lib/python3.10/site-packages/discord/bot.py", line 1114, in invoke_application_command
await ctx.command.invoke(ctx)
File "/home/container/.local/lib/python3.10/site-packages/discord/commands/core.py", line 375, in invoke
await injected(ctx)
File "/home/container/.local/lib/python3.10/site-packages/discord/commands/core.py", line 124, in wrapped
ret = await coro(arg)
File "/home/container/.local/lib/python3.10/site-packages/discord/commands/core.py", line 1312, in _invoke
await command.invoke(ctx)
File "/home/container/.local/lib/python3.10/site-packages/discord/commands/core.py", line 375, in invoke
await injected(ctx)
File "/home/container/.local/lib/python3.10/site-packages/discord/commands/core.py", line 132, in wrapped
raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: NotFound: 404 Not Found (error code: 10062): Unknown interaction
@daring quest
@digital lintel dm me code
ok
@digital lintel see ur dm