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

Issue with listeners, not emitting

So basically i have this code which checks for subcommand errors, and so i am tryna replicate the Subcommand unmatched emitation but the event isn't fired while the default listerners which are loaded are reacting to it. Maybe i am doing smth wrong so lmk
No description

global preconditions

do global preconditions affect listeners too? I'm having an issue where a messageCreate event goes thru even though i'm sending a message in the bot's DMs and I have a if (!message.guild) return; at the top of the code
Solution:
They do not

issue with code

I have this code and it's returning an error, I already checked by logging and message.member is defined, the error was also logged 3 times for some reason Code: https://pastebin.com/WWMVCewy Error:...
Solution:
didn't work, it ran the console.log twice and the error was thrown 3 times

Accidentaly registered duplicate context menu commands

While i was making a context menu command and registered it for the first time, i realised to add a space, but when i added a space to the command name, a duplicate has registered, and now i'm left with duplicates and i don't know how to get rid of the duplicate (I know the ids of both commands though.)
PLEASE HELPPPP...
Solution:
- Use the discordjs methods to deregister it - Or use bulkoverwrite - Or use https://slash-commands-gui.androz2091.fr/ to deregister it - And if you dont use bulk overwrite then configure idHints to avoid this problem in the future - And read the guide in general 👀...
No description

Error with the framework's code (appearantely)

There seems to be an error and the stacktraces lead to the framework's code. Even worse than that, the code worked when i hosted it in github codespaces but refuses to run locally
No description

General question on timer-manager and stopwatch

I have seen both of them so far and well i can see that, both are quite good at performance however i am not sure what to use, should i use timer manager to manage timers since it also stores them in a hashmap or should i stick to stopwatch and just store those, since my purpose is mainly managing short time durations less than a day at rare cases it can be more than a day. But for that we'll more likely depend on the database to store that. I would like to get suggestions on what should i use...
Solution:
Timer manager for your use case. Stopwatch is meant to only be used to measure how long some task takes, ergo the name.

Replacing Logger

Is there any way to replace the logger with custom on or editing it's style at least
Solution:
we have @sapphire/plugin-logger, or if that style doesnt suite you then you'll have to make a similar plugin yourself.

Minor error in the documentation

Hello, I found a small error in the documentation. https://www.sapphirejs.dev/docs/Guide/interaction-handlers/autocomplete The method name should be autocompleteRun and not autoCompleteRun....
No description

Does subcommand methods have context parameter?

Hey so i have a subcommand and so for some of it's subcmds am using a single method "event" and binding them to each subcmd but is it possible to know which cmd is ran since in a normal SapphireFramework#Command inheritance the messageRun provides a context parameter which has the commandName attribute pretty helpful not sure if it's that possible with the subcmds so i can identify which subcmd is ran

How can I remove a subcommand check?

I've got a switch that handle different subcommands, but I need to include a check for the subcommand in the helper function itself. Is there a way I can avoid needing to do this check?
Solution:
No description

Precondition error type

How to access the code of precondition error? to override the reply or something like that...
Solution:
we export a constant called Events from sapphire, you can use that as for the parameter types.. sadly TS doesn't let us strictly type that to the point where you don't need to specify the actual types (i.e. it's inferred) (we really would want to!) but if you use Listener<typeof Events.GuildCreate> then in your run you have parameters of incorrect types, TS will tell you this....

Accessing all commands array

How to access all commands array with their options (of discord api application command) to do something like help command ?

Bot throws error even though i declared my precondition already in the Preconditions interface

This is the code i tried putting: ```ts declare module '@sapphire/framework' { interface Preconditions { AntiLinkPrecondition: never...
No description

guild.roles.everyone but for boosters?

Wondering if there's a guild.roles.everyone version for the booster role?

Sapphire json Configuration

So I arranged my packages like this below: https://i.imgur.com/crYUZyB.png and I changed my .sapphirerc.json to:...
Solution:
Nevermind, searching deeper in the discord I see this file has to do with sapphire cli generation and not anything to do with core sapphire. Found a link on the doc for an overloaded client

Commands not respecting cooldown preconditions

```ts import { Command, RegisterSubCommand } from '@kaname-png/plugin-subcommands-advanced'; import { BucketScope } from '@sapphire/framework'; @RegisterSubCommand('legacy', (builder) =>...

contextMenuCommandDenied question

any way of getting the user who ran the context menu when the contextMenuCommandDenied listener is triggered?
Solution:
That is not the valid parameters for the listener. The types are error: Error, payload: ContextMenuCommandDeniedPayload So to get the interaction you then do payload.interaction and the guild therefore is payload.interaction.guild When programming it is always important to adhere to the parameter order and parameter types when writing and using functions. You should always consult documentation, and if working with a library like discordjs or framework like sapphire you’d also do well to refer to the source code, which gets linked for every symbol in the documentation....

question

what does contextMenuCommandRun return? and is there a way of getting the user id of the user who ran the context menu?...

Multiple command exports from a single file.

Is it possible to export multiple Command classes and they'll be recognised as seperate commands?, i.e:- i have a file where i have 2 classes each extending to the Command class or the Subcommand class from the sapphire plugin. And they'll also get stored in the command store

translate replys of sapphire like cooldown

guys how can i translate or change the sapphire reply like cooldown or requiredClientPermissions etc...