Custom Error Event

So I know, I can use UserError to throw an error if the user did something wrong. But what to throw if something unexpected happend, like a 500 to my own api. I thought maybe the normal Error but it isn't handled by the ChatInputCommandError Event. I want the user to get a error message in chat, so I need to use the interaction. Do I have to throw something else? Or do I have to listen to another event? Thanks :3
2 Replies
Favna
Favna10mo ago
Implement your own ChatInputCommandError message and reply to the interaction with your message. Either supply the message to the thrown UserError, or identify it through error.identifier and build the message at listener level. For example https://github.com/favware/dragonite/blob/main/src/listeners/commands/chatInput/chatInputCommandError.ts
GitHub
dragonite/src/listeners/commands/chatInput/chatInputCommandError.ts...
A Pokémon information Discord bot built around Discord Interactions - favware/dragonite
Peace
Peace10mo ago
Alr, thanks