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

on ready messages

is there any chance to disable "commands initialized" message on startup ?

Argument of type '"Staff"' is not assignable to parameter of type 'SimplePreconditionKeys | Simpl...

Error ```Error when loading 'C:\Users\User\Desktop\Bots and stuff\Gir-Unit V2\src\preconditions\ServerOwner.ts': src/lib/structures/commands/GirCommand.ts:95:26 - error TS2769: No overload matches this call. Overload 1 of 2, '(keyOrEntries: SimplePreconditionKeys | SimplePreconditionSingleResolvableDetails | PreconditionContainerArray): PreconditionContainerArray', gave the following error. Argument of type '"Trainee"' is not assignable to parameter of type 'SimplePreconditionKeys | SimplePreconditionSingleResolvableDetails | PreconditionContainerArray'. Overload 2 of 2, '(entry: PreconditionSingleResolvableDetails<keyof Preconditions>): PreconditionContainerArray', gave the following error....

Autocomplete `interaction.commandName` when used in a subcommand

What will be the contents of interaction.commandName in an autocomplete interaction handler when the invoking interaction came from a subcommand or a subcommand in a group? Is it just baseCommand subCommand and baseCommand group subCommand? On a similar note, does interaction.commandId change for each subcommand?
Solution:
So is the commandName property on the interaction that gets passed into the interaction handler just the subcommand name then or is it the parents? At this point, you've said both.

Disable And/Or Change Listeners Directory

Is there a way to change the default name of the listeners directory? If not, is there a way to completely disable automatic registration of the listeners? If there is, how do you register them manually?...
Solution:
In regards to changing the default name of the listeners directory, you will need a file called .sapphirerc.json and in there put this: this is just an example ```json...

TypeError: Cannot read properties of undefined (reading 'write')

```js \testing-forbidden\node_modules@sapphire\framework\dist\lib\utils\logger\Logger.js:27 this.write(ILogger_js.LogLevel.Error, ...values); ^ ...
Solution:
Actually I figured it out, ```ts const result = await model.create(document).catch((error) => { container.logger.error(error); });...

Dynamic route not working

I am currently utilizing the plugin-api with the following versions: - @sapphire/framework": "^4.2.2 - @sapphire/plugin-api": "^5.0.2" ...
Solution:
Okay! It started working after deleting the node_modules folder and reinstalling.

Error When trying to getString.

I'm in the process of updating djs 13 to 14. - "discord.js": "^14.9.0", - "@sapphire/framework": "^4.2.2", ...
Solution:
I'm in the process of updating djs 13 to 14. - "discord.js": "^14.9.0", - "@sapphire/framework": "^4.2.2", ...
No description

Slash Command User Arg Always Failing

I've been following the guide on how to create slash commands and I realized that whenever I attempt to run my command and enter in the user argument, it tells me the user is not valid. I've even tried this with the example command on the guide, so it doesn't seem to be something wrong with my code. Here is the code used: https://hastebin.skyra.pw/iyepoxidaw.ts (this is from the guide) Here is what it looks like when I attempt to run:...
Solution:
Seems you have to add the #0001 (or whatever tag) to the end of it. Kind of weird it doesn't automatically do that. Anyway. Solved.

check if commands initialized

is there a way to check if commands initialized or not
Solution:
is there a way to check if commands initialized or not

Slash and message commands.

Can I make a slash command and a message command in the same archive?

Whats the difference between the different imports?

Some packages reexport things from djs for example. What is the best practise to use? And whats the difference?...
Solution:
discord.js only exports a type which is an alias for string. @sapphire/snowflake is a TS implementation of the snowflake system. They are 2 completely different things. (also you could've found this out by checking the djs and sapphire docs)...

Handling deletion of all guild specific slash commands with BulkOverwrite

I've been using BulkOverwrite to manage slash commands for guilds and use the ApplicationCommandRegistryRegisterOptions to specify an array of guildIds to create guild specific commands with registerChatInputCommand. This works great as long as I have at least one guild specific command for a guild. The issue is when II remove a guild id from all the command ApplicationCommandRegistryRegisterOptions then it won't overwrite anything in that guild and so it doesn't delete the removed commands. Below I've included an example of two commands. Assume that previously both commands were registered for guilds ['111','222','333'] specifically. If I make an update to remove guild '222' from the Help Command and guild '333' from both the Ping and Help Command, then guild '222' will properly delete the Help Command, however guild '333' will not be updated and keep both the Help and Ping Command....
Solution:
Sapphire doesnt handle deletion of commands, not with bulk nor anything else. You'll have to use the DiscordJS methodologies for that. Alternatively you can use https://slash-commands-gui.androz2091.fr/settings...

User counts

Is it possible to get a semi-accurate / approximate user count without fetching all users / servers when trying to update it? I've tried: - client.users.cache.size (but this does not have all users included and i don't want to client.users.fetch() a lot) - Fetching every guild and using guild.approximateMemberCount while removing duplicates...

ButtonBuilder setEmoji?

I tried searching for this issue but haven't found anything that could help.

Having trouble with reporting precondition failure

I am trying to send an error message when a person who isnt the bot owner runs the eval command but i cant get it to work I followed the docs and even copied the example bot but nothing seems to make the thing work. I tried to console.log error.message but that doesnt console.log either Precondition ```ts...

Mentioning application subcommands

Follow up from this: https://discord.com/channels/737141877803057244/1086724151429042246 Is there a way to mention subcommands too? I noticed that base subcommands cannot be mentioned, i.e. in a subcommand /a b you cannot mention using </a:id>....
Solution:
</[base name] [subcommand name]:[base id]>

Task is set to execute hourly but executes 3 times

I registered a task, that should run at :00 every hour. For some reason, it executes it 3 times tho, 1. at :00 2, at :02 and the 3. at :05 past...

messagecommand generated from CLI error

I just started out with Sapphire and i was trying to use the CLI to generate a messagecommand but ran into this error
Unable to resolve signature of class decorator when called as an expression.
The runtime will invoke the decorator with 2 arguments, but the decorator expects 1.
Unable to resolve signature of class decorator when called as an expression.
The runtime will invoke the decorator with 2 arguments, but the decorator expects 1.
...
Solution:
I just started out with Sapphire and i was trying to use the CLI to generate a messagecommand but ran into this error
Unable to resolve signature of class decorator when called as an expression.
The runtime will invoke the decorator with 2 arguments, but the decorator expects 1.
Unable to resolve signature of class decorator when called as an expression.
The runtime will invoke the decorator with 2 arguments, but the decorator expects 1.
...
No description