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

Help with sappphire auth

i have problemms using the auth with sapphire
Solution:
if you do indeed have multiple outgoing requests they should also show up in the network tab

How to wait that the initialization of the ApplicationCommandRegistry is finished

Hi guys, is their away to wait for the completion of the ApplicationCommand registration? ```ts 2024-12-22 20:26:53 - INFO - Successfully logged in into Discord Connected to Redis for subscribing...

Does Custom Piece auto-loaded?

I am trying to develop a ReservationTask Piece using SapphireJS to perform a specified task after a certain time. First, I created a ReservationTask by extending the Piece class and then created a ReservationTaskStore to store it. In this case, I wonder if the ReservationTask Piece is automatically registered with SapphireJS. Also, if I add a custom Piece that inherits from this Piece, will it also be automatically added? I plan to refer to the following code frequently during development:...
Solution:
semi auto, you do have to configure the path of the store and add it to the store collection.

Stop sapphire from automatically loading pieces

I'd like to use sapphire's command class since I can adapt it more easily, however I want to prevent it from manually loading other pieces (like listeners). I remember there being an option for this but I pretty much can't remember so I'm asking here. P.S: I plan on loading commands manually, by calling this.container.loadPiece(), i just want to disable any type of automatic loading....
Solution:
Pass baseUserDirectory: null in your client options to disable loading, this is one of the steps at registering and loading virtual pieces.

What is the role of a Piece and a Store in SapphireJS?

From my research, it seems that a Piece cannot perform standalone actions. Instead, Pieces are stored in a Store, and developers retrieve them from the container's store to utilize them in other functionalities. Is this correct? I am looking for examples or related articles that explain the usage of Store and Piece, but the official documentation seems to lack such detailed explanations, so I am asking here....
Solution:
that is correct

Encountered error while handling an interaction handler run method.

Hello, I have encountered an error: ``` [ERROR] Encountered error while handling an interaction handler run method for interaction-handler "1_ActivateContractHandler" at path "C:\Users\diman\OneDriveДокументы\GNews_v2\dist\interaction-handlers\contract\1_ActivateContractHandler.js" DiscordAPIError[40060]: Interaction has already been acknowledged. at handleErrors (C:\Users\diman\OneDriveДокументы\GNews_v2\node_modules@discordjs\rest\dist\index.js:727:13) at process.processTicksAndRejections (c:\Users\diman\OneDriveДокументы\GNews_v2\lib\internal\process\task_queues.js:105:5)...

Use Prisma with SapphireJS

Hi, I saw in the Global preconditions guide you referenced this.container.prisma, which doesn't exist. I am new to Prisma, and I want to get started on using it with my bot, anyone have a guide on how to set it up?...

monorepo with sapphire

how would you go about installing a yarn or npm monorepo with sapphire bots?

Preconditions in Interaction Handler

Is it possible to use preconditions in the interaction handler? I was hoping to have preconditions work with my buttons as well 😁
Solution:
It is not, however, remember that preconditions are basically just glorified if else checks.

Difference with dev and prod > The application now has 0 global commands

Not sure what I'm missing here. When I run my dev command nodemon src/Bot.ts - everything works as expected, the bot is online and responsive, with 4 global commands. When I run my build command tsc - the build is successful...
Solution:
See the first big red block at the getting started guide https://sapphirejs.dev/docs/Guide/getting-started/getting-started-with-sapphire

text command triggered by mentioning bot (no command name)

I want to trigger a text command when the user mentions the bot, but with no command name. what is the best way to implement this?
Solution:
Add a listener called mentionPrefixOnly

I want to make a system about module command

I'm stuck right now, I only want 3 commands to be able to deploy globally, and in that there is 1 command to edit the modules, which will contain the commands. What I want to do is that the command to edit the module can automatically register a separate slash for that server. Can you help me?

Slash command autocompletion dynamic input options

I'm looking around the DiscordJS documentation and SapphireJS docs to see if there might be a way to add the ability to, essentially, have a user type a slash command like: /play input:<search terms> And when they are inputting the search terms, have options populate above like how some music bots do. ...
Solution:
Command#autocompleteRun can be async, which means you can execute a fetch HTTP request to retrieve the results and show them back to the user.

string-store not finding identifiers other than first in Schema on deserialize typescript

I am working on some new code for my bot and using the string-store utility. I've gone through https://discord.com/channels/737141877803057244/1303945790057746452 and https://discord.com/channels/737141877803057244/1303856829461168138 and have been able to get the system working with the steps in there. My schema is: ```ts import { Schema, SchemaStore, t } from '@sapphire/string-store';...
Solution:
Your store has 2 schemas, so when it deserializes a buffer, it can be one of the two. Compare the id or cast the value to the correct type to fix this.

Why my listener doesn't work?

Hello, i am trying to make a uptime checker thing. I'm currently just using a ready listener for test. main.ts ```ts import 'dotenv/config';...
Solution:
1. Which version of @sapphire/framework are you using? 2. What's your file/folder structure? 3. Did you use the CLI to generate your bot? 4. What's your main (CJS) or module (ESM) property in package.json 5. Are you using TypeScript? And if so, how are you compiling and running your code? That is to say, what are your build and startup scripts?...

my guild related listeners arent firing but my client ones are

pretty much just the title
Solution:
i just remembered that messageReactionAdd won't fire on uncached messages, unless u were to enable partials

Unexspected end of JSON input

Hey guys, I recently updated from API Plugin v6.1.1 to v7.0.3 and got into trouble with the new handling of request body. I try to extract the body of my request with const body = await request.readBodyJson();...
Solution:
You shouldn't read the body twice 😅

Updating paginated message pages while the handler is running

I'm trying to make a paginated message that can be updated after its creation. My command currently: 1. Responds with the paginated message with data from the database 2. Fetches new data from an API in the background...

JS Example has error with loading routes

I've downloaded the JS example from here: https://github.com/sapphiredev/examples/tree/main/examples/with-javascript The bot runs fine apart from a few issues with loading the routes ``` Error when loading 'C:\Users\Jacob\Downloads\sapph\src\routes\hello-world.js': TypeError: Cannot read properties of undefined (reading 'GET')...
Solution:
The second is because you need to install a build toolchain, see https://github.com/nodejs/node-gyp#on-windows The first... is because the code wasn't updated to Sapphire Plugin v7. If you don't need REST api plugin, just delete those files for now. If you do, then refer to the breaking changes, also we'd very much appreciate a PR ❤️ https://github.com/sapphiredev/plugins/blob/main/packages/api/CHANGELOG.md#sapphireplugin-api700---2024-11-02...