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

PaginatedMessage - change select menu string names

Hi, I want to change the string names in the paginated message select menu. Instead of "page 1" "page 2" I want a custom string based on the embed content. I've looked through the documents and don't see any string to change under PaginatedMessage.defaultActions. ...

got error idk what’s wrong with my code

Here this what i meant
Solution:
As for solution to the original question: Discordjs changed the intent variable case. Either use GatewayIntentBit enum or specify intents in UpperCamelCase...

Terminal Crash

Every time I stop a sapphire project using watch my terminal crash
Solution:
Terminal version was the problem thank you !

Preconditions in InteractionHandler

Can I execute a precondition in an Interaction Handler?
Solution:
that's what the parse method is for. Also keep in mind that preconditions are just glorified if checks, you can extract the logic to a seperate function and execute that function in both.

Commands aren't being updated on Discord's end

Hello. I'm having trouble with commands not being updated on Discord's end. I added options to one of my commands, but the option isn't showing up in Discord. I've also tried removing the command completely from the dist folder, but that just results in a command that times out, instead of saying the command is outdated.
Solution:
You can name it “snarky-remark”

Slash command registered, but not displaying.

I've got a test slash command that is getting registered, but not displaying in Discord. ```js import {Command, container} from "@sapphire/framework"; ...

Is it possible to use my own LoaderStrategy?

I want to add support for tsx. Currently I've got it working by editing the LoaderStrategy file in node_modules and setting shouldLoadTsFiles to true. Is there a way to do this using sapphire?

Only receiving interactions on local machine

Hi all, The title is quite self explanatory, but a little more detail here. I've been trying to get my bot to work on my production machine but it looks like interactions aren't being received on there. However, when I run the bot on my local machine, the interaction goes through perfectly fine. ...

Subcommands Broken

Hi everyone! I tried using subcommands w/ sapphire for the first time, and now it's just telling me that the interaction is not responding. The bot is online, but it's not responding to said command
Solution:
solved

PaginatedMessage not changing files

For some reason, PaginatedMessage doesn't seem to update the file when the page changes. How do I solve this? My code: ```ts const paginated = new PaginatedMessage(); for (const image of images) {...

Slash Command - The application did not respond - nothing in console.

I've set up a slash command, it appears in discord, but when I run it I get "The application did not respond". The application log doesn't show any activity. This is a shortened version of my command....
Solution:
If you want to use subcommands you need to extend the class Subcommand from @sapphire/plugin-subcommands, not Comand from @sapphire/framework.

unable to generate custom components using @sapphire/cli

.sapphirerc.json ```json { "$schema": "https://raw.githubusercontent.com/sapphiredev/cli/main/templates/schemas/.sapphirerc.scheme.json", "projectLanguage": "ts",...
Solution:
FWIW btw, development on the new version of the CLI has started in #cli-development
No description

optional argument

how to create an optional argument? like if the arg is empty, it uses the author, otherwise, it validates the argument into an user
Solution:
await args.pick('user').catch(() => message.author)
await args.pick('user').catch(() => message.author)
...

error: A compatible class export was not found.

My code ```ts import { InteractionHandler, InteractionHandlerTypes,...
Solution:
My bad they were interaction-handlers and I had them in the folder meant fo listener's

Error [ERR_REQUIRE_ESM]: require() of ES Module

So im getting this errror about 3 times for different packages ```js Error when loading 'commands\Colors\average-colors.js': Error [ERR_REQUIRE_ESM]: require() of ES Module \node_modules\color-thief-ts\dist\browser.js from dist\commands\Colors\average-colors.js not supported. Instead change the require of browser.js in dist\commands\Colors\average-colors.js to a dynamic import() which is available in all CommonJS modules. ...
Solution:
for color-thief-ts, read their readme: https://github.com/wh5938316/color-thief-ts it specifically says you need to import it differently for NodeJS. for mime it specifically says that as of v4 it only supports ES modules at the top of the README, and you're using CommonJS: https://github.com/broofa/mime...

Member cache and tracking members

Hello, I wanted to ask if by default theres any sort of limit or sweeping or such with Sapphire. Secondly I wanted to know if by default any member joining/being removed would accurately be reflected in the member cache without fetching it again. I also noticed that after i do a <Guild>.member.fetch() it returned exactly 10members less than are on the server if I check via Discords member list....
Solution:
wanted to ask if by default theres any sort of limit or sweeping or such with Sapphire.
there is not. This is controlled by discordjs. General rule of thumb is ask yourself: is it related to running commands or handling events? Then yes it's possibly Sapphire related. If not, then it's not....

too much errors

why does all of a sudden my sapphire bot stopped working? its not getting online when i ran dev script but used to work last week. im using ts version
Solution:
downgrade typescript to ~5.4.5, TS 5.5 broke some serious stuff. (btw cc @vladdy )...
No description