Sapphire - Imagine a framework

SIA

Sapphire - Imagine a framework

Welcome to the Sapphire Discord server! The next-gen object-oriented Discord.js bot framework can be found here.

Join

sapphire-support

discordjs-support

old-sapphire-support

old-discordjs-support

old-application-commands-and-interactions

Async Preconditions

Helloo! It seems that I am unable to create a precondition that is async, whenever I try to write one with async. I get The inferred type of 'chatInputRun' cannot be named without a reference to '.pnpm/@[email protected]/node_modules/@sapphire/result'. This is likely not portable. A type annotation is necessary. Here is the code in question: ```ts public override async chatInputRun(interaction: Interaction) {...

Subcommand Preconditions Support

I've got the below code to create a command with subcommands and preconditions in ESM JS. My issue is that no matter what I seem to do, and I've had a look on the docs and had a look at the repo Favna linked here https://discord.com/channels/737141877803057244/1143510279024545864/1143541634248740955 , the preconditions on the subcommands never seem to be acknowledged, either in the precondition or the commands args. ```js import { Subcommand } from '@sapphire/plugin-subcommands'; ...

QUESTION

What is the difference between Sapphire Framework and discordjs what is the benefits between both two

Sample implementation of per-subcommand preconditions

Hello! Are there any examples on how would I be able to implement the new feature? And I suppose this supports both interaction and message preconditions? And would this be a better option instead of using precondition decorators? Thank you!

Error: Module did not self-register

I'm getting this error when I run my tests for some reason, how can I solve this? ```xl Error when loading '/path/to/project/dist/commands/developer/eval.js': Error: Module did not self-register: '/path/to/project/node_modules/.pnpm/@[email protected]/node_modules/@sapphire/type/prebuild/type-node-v108-darwin-arm64-unknown-unknown/type.node'. at Object.Module._extensions..node (node:internal/modules/cjs/loader:1340:18) at Module.load (node:internal/modules/cjs/loader:1119:32)...

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?