Sapphire - Imagine a Framework

SIA

Sapphire - Imagine a Framework

Sapphire is a next-gen object-oriented Discord.js bot framework.

Join

sapphire-support

discordjs-support

old-sapphire-support

old-discordjs-support

old-application-commands-and-interactions

Make commands register when i run a command like `!sync`

Hi, I used the CLI to generate a project and noticed it syncs everytime a file changes. I have autosave enabled so this will get ratelimited pretty fast. Is there a way to make it sync slash commands when I run a command (and automatically use all the registerApplicationCommands )? Also wondering if there's a way to make all commands "guild" commands instead of having to give guildIds every time I register...
Solution:
Sapphire offers no built-in commands but you can leverage https://www.sapphirejs.dev/docs/Guide/commands/application-commands/application-command-registry/advanced/registering-application-commands-outside-a-command to implement a system like that yourself. As for guildIds, you can just do ```ts // somewhere...

confused

when i make the file extension to js it gives me 5 error and says the file should be in TS extension which i did but when i follow the guide now it gives me a new error

Is it possible to edit the default message returned by "preset preconditions"?

For example, the precondition set by <CommandOptions.requiredClientPermissions> returns I am missing the following permissions to run this command: Manage Channels as the <UserError>.message parsed in the ChatInputCommandDenied listener, but I'd like it to return something else.

Question

Hey! What is the difference about sapphire and discord.js? Or what is sapphire? I read the docs but i dont understand

__importStar is not defined

Hey! I am using a star import in my bot but whenever I try to run the dev script, it gives me the following error: ``` const dotenv = importStar(require("dotenv")); ReferenceError: importStar is not defined...

Fake Message Execution

Is there a way to create a fake message and execute a command off of it? I want to use it for an execute command similar to Jishaku execute (for dpy) and was curious if it was possible. Thx

extend command

i'm unsure how to go about doing this but how do I extend Command so that its options also include a description usage and categories array

Converted to es6 module, commands not loading

INFO - Logging in
INFO - logged in
INFO - ApplicationCommandRegistries: Initializing...
INFO - ApplicationCommandRegistries: Took 0ms to initialize.
INFO - Logging in
INFO - logged in
INFO - ApplicationCommandRegistries: Initializing...
INFO - ApplicationCommandRegistries: Took 0ms to initialize.
then it's frozen....

Is there anyway to register slash command for guild and global separately.

I want to make a guild slash command i18n . each guild will have it own slash command language by register slash command per guild. Is there anyway to do it separate from global slash command register.

Sapphire-like Listeners for other Emitters, such as ShardManager?

Probably a stupid question, but I've looked and haven't found any. Does Sapphire support listeners for other emitters? For example, if I want to listen for the shardCreate event of ShardManager. Sapphire makes event handling so simple, so I figured I'd hope that there is, instead of going manual....

scheduled tasks plugin compatibility

It is possible to use upstash redis server with the plugin?
Solution:
We use Bullmq so best check out the exact status there. For example https://github.com/upstash/issues/issues/18

it's bugging for me

Cannot use import statement outside of a module

Event before interaction handlers are ran

There are ChatInputCommandRun and ContextMenuCommandRun events, which are emitted before the run method. Is there anything similar for interaction handlers which is emitted after parse but before run?
Solution:

How do I handle this UserError?

I've been fiddling around with the subcommands plugin and I see that it throws an error ("No subcommand was matched with the provided arguments.") every time there is not a default defined and it doesnt match with a command. I am not trying to add a default, but I am trying to handle this error by adding a response message, e.g. "Did you mean to execute ...". I have tried using a listener to listen to Events.Error but it never gets fired....

How to transform array with shapeshift using default values?

I have an array which I'm trying to validate with shapeshift: ``ts const bans = JSON.parse(data); const defaultReason = Imported by ${interaction.user.username} from ${link}`;...
Solution:
Solution: ```ts const banList = s .array(s.string)...

Slash Commands

Hey, has anyone experienced issues with slash commands randomly deregistering? This has been happening to me every week or so. There are no errors in the logs, so I’m confused as to what exactly is going on.

Multiple Button Handlers, only 1 takes in a request

currently, I have 2 seperate files that both have button handlers. However, when a button is pressed, it only does parsing in 1 of the files. Both are in the interaction-handlers directory. src/interaction-handlers/operation.ts ```ts import {...

Add Choices To An Already Registered Command

Is there any way to add choices to an already registered command? For example, say I have a command that allows a user to add a fruit to a list. Then I have another command that allows the user to take the fruit off the list. I want to be able to update the choices in the command every time the user adds or removes a fruit. Is this possible with Sapphire?...

Creating a button handler

Hey! I would like to know if there is a way to create a button handler using Sapphire. I would like to read all files from a folder called "buttons" and store the data inside my container. I'd then check if there is an existing button with the given interaction id inside my container and if there is, I'd run the execute function. I came up with some code but can't manage to get it working. I'll attach it down below. Thanks in advance for all the help 🙂...