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

Adding a command to a guild after client is ready.

I want to make my bot modular by allowing people to enable and disable modules, and for the bot to then set the registries to add the guild etc, which functions will i need to make use of? Can't figure it out on the docs
Solution:
why not just use slash commands and let people manage that through the Discord permissions UI so you don't have to bother

Emoji In Context Menu Command

Hey, I'm trying to put an emoji in a context menu command and it's throwing an error - is that expected? I'd expect emojis to work when registering the command, I'm guessing this might be a bug with the name validation that Sapphire does? Sample Code...
Solution:
I'd expect emojis to work when registering the command, I'm guessing this might be a bug with the name validation that Sapphire does?
Sapphire doesnt validate names. DiscordJS does. so you'll have to go there it's part of @discordjs/builders...

commandDenied Event not Fired

All is in the title (and the file is loaded because I tried to put a console.log in the constructor and it was printed) I have a command with a cooldown and when the cooldown is reached, I get "App not responding" but nothing in console (My run() only console.log the params)...
Solution:
I’m pretty sure you need the listener to be listening to the “chatInputCommandDenied” event, not just “commandDenied”

HMR plugin error

Everytime I start up my bot with the HMR plugin enabled I recieve this error with all my commands:
Solution:
Haven’t tested but pretty sure this is solved with the new version will open a new post if I encounter anymore errors

Recognising "hidden" in CommandOptions

Hello, I realise this is more a TypeScript question than a Sapphire question. What type should I add to the options parameter to make it recognise hidden: boolean? I was thinking something like options: Command.Options & {hidden: boolean} but it didn't work. Thanks!...

How to create errors like this

I'm used parse function but It doesn't look like in the photo.

Interaction user locale first

Hello, I would like to get the TFunction from i18next based on the user locale first and not the guild one Is there a way to do this?...

not working

Hi, my bot is not working does anyone know why? index.ts: ```js import { SapphireClient } from '@sapphire/framework';...
Solution:
3. I dont have a main property
you say you following the guide but......

Hybrid commands

Is there something like hybrid command which can be used to create prefix and slash commands and also the execution together like discord.py
Solution:
¯\_(ツ)_/¯

@skyra/env-utilities is not assignable to parameter of type 'never'

I am not sure what to do here https://juan.evaded.tax/i/k6e74.png...
Solution:
it's ArrayString you need, not EnvArray

Error: Request aborted manually

Hi, sorry if the tag is wrong, I'm not really sure what all of them mean. Anyways, I use the @sapphire/async-queue package and I came across an issue where calling the abortAll method led to a "Request aborted manually"-error. Attached is the stack, in case that helps....
Solution:
thats literally what abortAll does

A compatible class export was not found.

When use HMR and edit files It always sends an error, no matter what file is being edited: ```console 9|Wishbot | [ERROR] [HMR-Plugin]: Failed to load pieces from /root/node/Customers/Wishbot/src/commands/collection.js. Error [EMPTY_MODULE]: A compatible class export was not found. [/root/node/Customers/Wishbot/src/commands/collection.js] 9|Wishbot | at LoaderStrategy.load (/root/node/Customers/Wishbot/node_modules/@sapphire/pieces/dist/lib/strategies/LoaderStrategy.js:92:19)...

Is it possible to use discord.js-light with Sapphire?

The title is self-explanatory, I think.
Solution:
If you're asking about if the framework will work, we can't guarantee it because it was not made with discord.js-light in mind. I'm not sure about the best way to make sapphire use it though, forking and overrides both sound like good options

Is Sapph.xyz bot related to this project/community?

Asking because of the name resemblence and i dont seem to find it in the server's bot list - is it in any way related (owner, uses sapphirejs, etc..) or just a name similarity?
Solution:
Completely unrelated. Same goes for the bot that's actually called "sapphire"

Typing the Err generic of Result to be empty

Sorry if this is a basic Typescript question! Is it possible to type a function's output so that I can return Result.err() without any parameters? f.e. ```ts function myFunction(): Result<true, ???> { if (condition) return Result.ok(true) else...

Added new options to slash command; not being reflected on discord

```ts registry.registerChatInputCommand((builder) => builder // .setName(this.name) .setDescription(this.description)...
Solution:
Found out why, error with compiling made there be duplicate files: the old one and the updated one

Handle Crash on DiscordAPIError[50001]: Missing Access

The scenario that causes this crash is the bot tries sending a message to a channel it doesn't have access to. Now I can solve this issue by checking it has permissions before hand or catching directly on the send, but my question is, is there a way to keep the bot from crashing if I miss a check at some other point? I do have an error.ts listener set up but doesn't seem to be making a difference. ``` /Users/x/Work/bot/node_modules/@discordjs/rest/dist/index.js:667 throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData); ^...
Solution:
I figured it out so nvm it's because I wasn't awaiting on my send calls

"dm_permissions: false" dont work

I was trying to make the slash commands not visible in the md but it doesn't work for me, can you tell me why ```typescript export class Channel extends Command { public registerApplicationCommands(registry: ApplicationCommandRegistry){ registry.registerChatInputCommand({...

How do i make an entire array an autocomplete?

I have a huge array and I want it to be autocomplete for a command how would i go about implementing that into a AutocompleteHandler ?
Solution:
first of all, you have to limit it to 25(? i forgot the max) results secondly, you just return the array in the proper order, and you sort it by using a fuzzy searching algorithm such as Jaro Wrinkler (use @Skyra/jaro-wrinkler for example)...

Error when adding a String option

Hey, when using ..addStringOption I get a error of ExpectedValidationError > s.instance(V). It works with adding a user option, but not a string option? ```js .addStringOption(option => {...