How to properly handle UserErrors?
I'm using the official sapphire template and want to throw a UserError inside a context menu command.
How do I correctly handle the error and send a message to the user?
I saw
contextMenuCommandDenied.ts
and thought that would handle it but I don't get a response and the error is shown in the logs.F
Favna•412d ago
contextMenuCommandDenied
is for precondition denials for context menu commands. Errors go in the error events. The full list of which can be found here: https://www.sapphirejs.dev/docs/Documentation/api-framework/#events.
That said, that doesn't mean they aren't UserErrors. UserError is just a class that extends Error, it doesn't say anything of where it is thrown. You can check other bots to see how they handle errors.S
Sapphire•412d ago
Discord bots that use @sapphire/framework v4
- Official Bot Examples ᴱ ᴰ ᴶˢ
- Archangel ᴱ ᴰ
- Dragonite ᴱ ᴰ
- Radon ᴱ ᴬ
Discord bots that use @sapphire/framework v3
- Arima ᴱ
- Nino ᴱ ᴰ
- Operator ᴱ ᴬ ᴰ
- Sapphire Application Commands Examples ᴱ
- Spectera ᴬ
Discord bots that use @sapphire/framework v2
- Materia ᴱ
- RTByte ᴱ ᴬ
- Skyra ᴬ ᴰ
- YliasDiscordBot ᴬ
ᴱ: Uses ESM (if not specified then uses CJS)
ᴬ: Advanced bot (if not specified it is a simple bot, or not graded)
ᴰ: Uses Docker in production
ᴶˢ: Written in JavaScript. If not specified then the bot is written in TypeScript.
Welcome to the Sapphire Discord server! The next-gen object-oriented Discord.js bot framework can be found here.
2.2KMembers
View on DiscordWant results from more Discord servers?
More PostsCan I set different requiredUserPermissions for each subcommand?Just wondering if this is possible, and how. ThanksHandling BulkOverwrite Registry ErrorsWhen I encounter this error
```
[ERROR] ApplicationCommandRegistries(BulkOverwrite) Failed to overwrEvents for VoiceHow can I do something like the following but for voice?
```
import { Listener } from '@sapphire/frHow do I use autocompleteRun on subcommands?^ As the title says. I can't seem to figure out how subcommands can have autocompleteRun implementedMessage editing fails even though message can be fetchedWhenever I want to edit an ephemeral message I get the following error:
```js
[ERROR] Encountered erProblem with ephemeral messagesI currently have a command which sends a button, problem is, once the button is pressed, I can't remIs recommend have split autocomplete handlersI want know is recommend have split handler such as characterAutocomplete & itemsAutocomplete.Error serverHow can I solve this error ?
```
Error [ERR_SERVER_ALREADY_LISTEN]: Listen method has been called m