Throwing on unhandled interaction
Hey, I just wanted to quickly check this idea - If I assign a listener to interaction create and then set a 4 second timeout, if the interaction hasn't been deferred or replied to I can log an error right?
8 Replies
Log the error where exactly? Consol?
Console
I'll be logging it via sentry to track it
Yeah I don't see why you couldn't do this in an error listener for example
Seems fine by me
Is there a specific event thats emitted for this / all errors that I could just listen to?
The other thing is getting information about what is failing, an error listener would need to let me know for example the id & name of what interaction didn't complete
I think you'd have to listen to xCommandError and make one for each of the different types of commands you have
E.g. message, interaction and context
Not sure what info you can get. I know you can parse the url but not sure of the context you get specifically. I'd try out and see what you can get
https://github.com/AnswerOverflow/AnswerOverflow/blob/bot-pre-release-polish/apps/discord-bot/src/listeners/commands/command-failure.ts here's how I ended up implementing it
GitHub
AnswerOverflow/command-failure.ts at bot-pre-release-polish · Answe...
Indexing Discord Help Channel Questions into Google - AnswerOverflow/command-failure.ts at bot-pre-release-polish · AnswerOverflow/AnswerOverflow
Responds to failed interactions, logs to the console, and emits a message to sentry with command info
Nice!