arguments
how to make arguments throw error when smh is not filled for ex
!prefix set
- but the prefix
is required23 Replies
i dont know if i explained it correctly lmao
this thing doesnt even emits
i tought its gonna be it
but no
or im doing it wrong
MessageCommandDenied is for preconditions, not arguments errors. You catch argument errors in MessageCommandError.
The full list of events can be found here: https://www.sapphirejs.dev/docs/Documentation/api-framework/#events
And you can also reference other bots that already use Sapphire:
Discord bots that use @sapphire/framework v4
- Official Bot Examples ᴱ ᴰ ᴶˢ
- Gemboard ᴱ ᴰ
- Dragonite ᴱ ᴰ
- Radon ᴱ ᴬ
- Sapphire Application Commands Examples ᴱ
- Archangel ᴱ ᴰ
- Zeyr ᴰ ᴬ
- Birthdayy ᴰ
- KBot ᴱ ᴬ ᴰ
Discord bots that use @sapphire/framework v3
- Arima ᴱ
- Nino ᴱ ᴰ
- Operator ᴱ ᴬ ᴰ
- 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.
umm
still not working
the command is working but the args error doesnt shows up
okay i debugged this code and it seems the listener is loaded but it doesnt fires idk why
Solution
found it, i was using wrong event. correct event: subcommand error
how to make subcommand/command custom property like this (this is not valid but i want it to be)
nvm solved
but now i have question how to:
1. handle permissions (custom responses etc)
2. handle cooldowns (custom respnose)
Use detailedDescription.usage. DetailedDescription is an interface you can augment.
Listen for the precondition denied event, identify the error with error.identifier, and use the error.context to get the data of the violation (available for both of these) and then you can send a custom reply from the listener.
ty
Cooldown: https://github.com/sapphiredev/framework/blob/main/src/preconditions/Cooldown.ts#L65-L71 (
context.remaining
)
Permissions: https://github.com/sapphiredev/framework/blob/main/src/preconditions/ClientPermissions.ts#L108-L114 (context.missing
)how to import this event, i dont see event named like this
nvm i got it
another issue
i've got
and this
it doesnt even logs
limit
You really should just use the built in cooldown...
Error is pretty clear I'd say but maybe you should just start over and use @sapphire/cli to generate a project because if you falter at configuring typescript config you're really gonna have many many many issues down the road
Also read the handbook https://www.typescriptlang.org/docs/handbook/intro.html
Handbook - The TypeScript Handbook
Your first step to learn TypeScript
Sapphire Framework
Getting started with Sapphire | Sapphire
To install Sapphire, you need to install both discord.js and
And you'd also do well reading the DiscordJS guide https://discordjs.guide/#before-you-begin
discord.js Guide
Imagine a guide... that explores the many possibilities for your discord.js bot.
OP left server so closing thread