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

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...

Subcommands help

Hello, I have around 50-60 commands which I want to categorize in subcommands, is there an easy way to do it? or I'll have to recode it. I remember this framework having some cog system but unsure if I can setup subcommands with it. Thank you for the help

OwnerOnly precondition not working

Hello there. I just yoinked the OwnerOnly precondition from the guide and the Github repo but I just can't make it work. I don't get an error, I also yoinked the precondition failure messages, I don't get any info about why its not working. I only get "The application did not respond". Without the precondition my command works. OwnerOnly.ts ```ts import { Precondition } from '@sapphire/framework';...
Solution:
fixed it

Whats the command to send messages about the user info

new to js
Solution:
Sapphire and discordjs offer no built in commands.

Force restarted after getting discord.js error

Hi, i want to ask about my bot, if i get some error from sapphire like error from "args", that not make my bot restarted, but if i get some error from discord.js like "Unknown Message" or nothing else the bot force restarted, can you help me pliss? <a:NGS_PleadCry:958030314943434752>