sapphire-support
discordjs-support
old-sapphire-support
old-discordjs-support
old-application-commands-and-interactions
ts not compiling well
I don't know if it's a discord.js/sapphire issue or just a compiling issue, but when compiling normally or with ts-node, bot doesn't run at all but instead shows an error on all command files (picture below) and I dont know how to fix it
Solution:
update your dependencies.
Permissions
is removed in DJS v14, you need matching versions of all the Sapphire dependencies (their latest versions)
How To Use The Enum Arg?
Hello, I'm trying to use the enum arg in order to accept only one of two strings. How does one pass in the acceptable options for the enum?
Could someone provide me with an example?...
Solution:
args.<method>('enum', { enum: ['one', 'two'] })
Let's users have custom folders for pieces
As the title states, I think sapphire should let people place commands, listeners and interaction handlers...etc( all pieces ) in custom folders. Maybe sapphire should let people set the paths of those pieces in
SapphireClientOptions
.Solution:
Already possible. You can register a path for a store.
If it is for a single store then use
```ts
<this>.container.stores.get('mystore').registerPath('path/to/the/folder/here')...
piece.aliases is not iterable
Hi everybody, I was just coding a simple bot, it has only a few, basic commands like ping-pong. I just keep getting this error, and I can't figure out where it comes out from. I got it first when I created a class which extends InteractionHandler, and now even by removing that class I keep getting it.
Any help is welcome.
This is the class I am talking about. Don't know if I'm missing something or doing something wrong.
```JS...
Solution:
You put the InteractionHandler in the commands folder. It should go in the
interaction-handlers
folder instead.
guild commands not showing in command lookup
Another thread was posted about this just over a week ago, but the OP deleted his message.
Basically, like the thread title says, I have a guild command, generated by the CLI, and it's just not showing in the command picker thing.
Here's the code for the command: ```ts...
custom prefix
so i have a normal client just like the example one i was wondering how can i implement the fetch prefix function there
how would you go about logging shard creation in sapphire?
I understand that shards are auto created by default, how would I go about logging it? Does anyone have a bot on github that could show an example? i'm more of a visual learner :)
Solution:
Shards are entirely managed by DiscordJS. Sapphire doesn't do anything shard related.
DiscordJS has several event emitters that you can listen to using Sapphire to get information about shards:
https://github.com/sapphiredev/gemboard/tree/main/src/listeners/shard/...
What is a Piece?
I often read this term but dont really understand it
Solution:
A "piece" is literally a "piece" of your code. Every Sapphire class (commands, preconditions, arguments, listeners, etc) extend the Piece class. Pieces have some properties that are therefore available on all of those classes.
GuildIds Array Empty = global command?
If i leave the guilds array empty, does this mean the command will not be registered or will it be registered globally?
Basically, I want to know the behavior when providing these values
[]
['']
undefined
...Solution:
[]
= global
undefined
= global
null
= global
['']
= invalid 🙄...How necessary (in practice) is it to set idhints?
Working on a public bot, and I am not sure how to handle this effectively when I work with a dev and a prod version of the bot. Is it really necessary for me to make an effort in this topic or does it work just fine without
idhints
?Solution:
Related to the original question, I found this https://www.sapphirejs.dev/docs/Guide/application-commands/application-command-registry/advanced/setting-global-behavior-when-not-identical
if using this will I not have to worry about ids?...
How do you initialise a UserSelectMenu?
As per title, how do you do it?
As of right now, I only see MessageSelectMenu available for use and cannot import anything "user select menu" related.
Here's my dependencies....
Solution:
UserSelectMenu is not in DiscordJS v13
so update to DiscordJS v14 and Sapphire v4
and it will just™️ work™️
Other than that refer to https://www.sapphirejs.dev/docs/Guide/application-commands/interaction-handlers/select-menus but where-ever it says StringSelectMenu just do UserSelectMenu....
selects
Does sapphire support the (kinda) new Role & Channel selection menus?
Solution:
It should anyway
turn off dev mode?
Not finding anything in docs/online, is there a production mode? (yes, this is building and running dist bundle)
Solution:
Set
NODE_ENV
as production

Very intense application command fetching
I'm using the new sapphire, v4.0.1 , with discord js v14.7.1
Suddenly, the the bot does an incredible amount of fetching of application commands, resulting in rate limit.
{"timeToReset":1100,"limit":50,"method":"GET","hash":"Global(GET:/applications/:id/commands)","url":"https://discord.com/api/v10/applications/ID/commands?with_localizations=true","route":"/applications/:id/commands","majorParameter":"global","global":true}
...Solution:
@bomi can you test the changes made in the PR release if they achieve the same end result?
...
npm install @sapphire/framework@pr-598
npm install @sapphire/framework@pr-598
Use preconditions outside of the command class
Is there a way to run a precondition check outside of the command class for instance if I wanted to check if someone would pass a precondition in a function
Solution:...
import { someCondition } from '../lib/utils/someCondition';
if (someCondition) return;
import { someCondition } from '../lib/utils/someCondition';
if (someCondition) return;
Setup bot hosting with SparkedHost
okay , i searched on gg and found a host is sparkedhost , i setup everything , i use filezilla to transfer all files in dist folder to run bot , but seem like it cannot run some sapphire functions
it should read all interactions,commands ,... like
but i dont know why , mayb my setup have something wrong...


How can I effectively use the `PaginatedMessage` function?
``js
const queue = this.container.client.player.getQueue(interaction.guild!);
if (!queue) return interaction.reply({ content:
${this.container.client.dev.error} | I am not in a voice channel`, ephemeral: true });
if (!queue.tracks || !queue.current)...Solution:
```ts
import { PaginatedMessage } from '@sapphire/discord.js-utilities';
import type { Command } from '@sapphire/framework';
async function aa(this: Command, interaction: Command.ChatInputCommandInteraction) {...
sapphire steals the CPU
We just deployed a bot on a droplet...
No I just got the message of my co-developer, that the process of the bot requires the Whole ram and CPU of the droplet, so Ubuntu shut the process down. The bot is in comparison very light, so I can't imagine how this happened. It is running via pm2. Any ideas? On my local test machine, normal running cost only 27 MB, not 1 GB 🤷🏻
Thx...
Solution:
Sounds like an issue on the OS end, especially if it doesn't happen locally. Sapphire also has a very very tiny memory footprint compared to discordjs itself.
Application Commands
```
[ERROR] ApplicationCommandRegistry[toggle author] Failed to register guild application command with name "Toggle Author" for guild "993567738360496288" DiscordAPIError: Missing Access
at RequestHandler.execute (C:\Users\weila\Documents\Discord Bots\Massive-Automation\node_modules\discord.js\src\rest\RequestHandler.js:350:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at RequestHandler.push (C:\Users\weila\Documents\Discord Bots\Massive-Automation\node_modules\discord.js\src\rest\RequestHandler.js:51:14)...
Solution:
3. Copied the wrong Id
