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

Question about "runIn" preconditions

Hello! According to the docs regarding setting the channel types a command can run in. In theory setting the command's runIn to
// ...
runIn: [CommandOptionsRunTypeEnum.GuildText, CommandOptionsRunTypeEnum.GuildVoice]
// ...
// ...
runIn: [CommandOptionsRunTypeEnum.GuildText, CommandOptionsRunTypeEnum.GuildVoice]
// ...
Should make the command run in both text channels and voice based text channels. However, setting it like this, doesn't allow me to run them to both channel types. What I can do was to only set one channel type in runIn and it'd work for that particular channel type only. How can I make it so that I can allow the command to run in both channel types?...

Passing a new parameter to commands

Heyo! I am converting my bots to Sapphire, and on one of them, I pass the entity manager of my ORM to each command as I call them so I don't create too many (or else it creates a memory leak). So basically, I create an entity manager every time there's an event, instead of every time I need one. That worked fine before Sapphire, because I was the one calling my commands. But now, I am not anymore! So I thought about a way to do it....

ts-node vs tsc

when i compile with tsc the code works fine, but with ts-code it stops for some reasons

First Argument

const user = await args.pick("member").catch(() => null); With this code I tried to make the bot get the member from the first argument but looks like it only gets the member if the bot finds it on the second argument, third, etc, how can I fix it?...

Error

```js [ERROR] Encountered error on event listener "CorePreMessageCommandRun" for event "preMessageCommandRun" at path "C:\Users\cmart\Desktop\Discord Bots\Sapphire\node_modules@sapphire\framework\dist\optional-listeners\message-command-listeners\CorePreMessageCommandRun.js" TypeError: result.isErr is not a function at Object.messageSequential (C:\Users\cmart\Desktop\Discord Bots\Sapphire\node_modules@sapphire\framework\dist\lib\utils\preconditions\conditions\PreconditionConditionAnd.js:10:18) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async CoreListener.run (C:\Users\cmart\Desktop\Discord Bots\Sapphire\node_modules@sapphire\framework\dist\optional-listeners\message-command-listeners\CorePreMessageCommandRun.js:19:25)...

trigger command with regex?

is there a way to use regex patterns to to trigger a command when someone sends a message that matches one? commando-js had a 'patterns' property in the command constructor, I'm looking for something like that. sorry if i missed an obvious answer

Preconditions

Using preconditions, If a user does not meet the requirements to run a command I want the bot delete the message instead of sending a message, how can I do it?

Can I have multiple autocomplete interaction handlers?

When an autocomplete interaction comes through, if one of the autocomplete handlers returns this.none() in the parse method, will it still run the other handlers until it finds one that returns this.some()?

Lot of problems with SapphireJS

Hello, I have some problems First of all with the i18next plugin integrated into sapphire, I would like to compile my languages ​​folder instead of leaving it forever in the dist Then with the ModalSubmitInteraction, I cannot retrieve Interaction to pass it to i18next in order to display a translation...

string option, support for strings inside quotes?

Feel a bit silly making a thread out of this as it's a question rather than a support topic I have read that using args.pick("string") will match the next singular word, or the phrase contained "within quotes". I gather that options and flags are generally used for numerical or bool like inputs, but when reading the value of a flag, it does not behave the same way. ...

eslint-config error: cannot access C: due to not declared in deps (Yarn v3 PnP)

Full error: Error: synckit tried to access "C:, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound....

contextMenuRun not firing

Unsure where to look or what's wrong, I had this command working a month or so ago. The registration happens fine, and I can see the command (and see it updated), but the interaction itself just times out. ```ts @ApplyOptions<CommandOptions>({...
No description

Using args functionality on another message

Hello, I want to use the Args.pickResult() function on another message. Is there any way I can do this? For example, making an args object for that message?

Unknown interaction with paginated message custom actions

Hi there, I'm using sapphire's paginated messages from @sapphire/discord.js-utilities. Before adding custom actions, a stop button worked fine. I recently set custom actions to: ```ts...

Interaction and Message Function Preconditions

Hey! Is it possible to create function preconditions for both interactions and messages under the same exported decorator? Or do I have create different exports for each of them? Alternatively, would I be able to create such function precondition that accepts both messages and interactions?...
Solution:
Sure, just make sure your function takes an argument that can be both types and determine which it is by using an instanceof check

preconditions don't run

I have a precondition (src/preconditions/Setup.ts) being used in a subcommand command (src/commands/setup.ts) and neither the command nor precondition run. I've added debug console.log's to both, and neither output whenever I use the command. I can provide a project .zip in DMs upon request....

Deleting Buttons

Hello, I have a chat input command which sends a confirmation embed (this contains a confirm and deny button), which this is part of the ChatInputCommandInteraction I have the confirm button handler in my "interaction-handlers" directory which handles the button click. On the button click, I want to delete the action row from the ChatInputCommandInteraction, however, I only have access to the ButtonInteraction within the button handler which is a separate interaction....