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

Is it possible to dev Offline ?

I will be on a plane for a while, and I would love to know if it's possible to use discord.js API localy
Solution:
Can you send discord messages while offline. There is your answer (no)...

Converters

Hey wondering if, it is possible to have type convertions in sapphire or with any of it's utility packages, I have seen the Resolver class but i think there are some methods missing in example the library dpy has a series of converters one is the ColorConverter, so i was wondering whether it's possible to have such converters in sapphire https://github.com/Rapptz/discord.py/blob/master/discord/ext/commands/converter.py#L619
Solution:
I think you're just looking for arguments https://www.sapphirejs.dev/docs/Guide/arguments/using-arguments But also do not forget that nothing stops you from simply defining a function in some utility file and export it then import it elsewhere. You're not restricted to what the framework provides, you can still use regular JavaScript concepts too. If you must have the function as part of the container though then we have this plugin: https://github.com/sapphiredev/plugins/tree/main/packages/utilities-store#readme Other than that, the actual conversion is something you're gonna have to write yourself. I don't think discordjs exports their color conversion functions, but we're not going to mirror their code (overhead, maintenance, etc) so if you want to use what discordjs used internally then create an issue on their repo asking for the functions to be moved to a subpackage (assuming it's not exported). ...

InteractionHandler

Im kinda new to discord.js so im abit confused on how to make it so that only the command author can use the select menu in interaction handlers
Solution:
Pass the command author id through with the customId field (alongside some kind of identifying information) then validate it and return some/none accordingly. View the sapphire guide on interaction handlers for more info on the latter. https://www.sapphirejs.dev/docs/Guide/interaction-handlers/what-are-they Mind you that customId is limited to 100 characters. If the data you need to pass doesn't fit into that when stringified you'll need to do some compression, for example for @Dragonite I have this https://github.com/favware/dragonite/blob/main/src/lib/util/utils.ts...

Command Handler

Hello, just wanted to check for some clarification, ACR, for slash, there's 0 need for a command handler correct? or am I misunderstanding? I am new to slash commands and their usage..... or am I just completely dumb here lol
Solution:
You need to match the incoming data to the proper run functions so yes there is a need

CommandStores not showing commands in order

I just finished the rewrite of a bot, tested the help command and looks like the commands are not showing in order, just tested on the Development bot and they are in order, this doesn't cause any issues but I want them to show correctly, any idea? Could be a host issue?
Solution:
this.container.stores.get("commands").sort((a, b) => a.name.localeCompare(b.name))
this.container.stores.get("commands").sort((a, b) => a.name.localeCompare(b.name))
...

Unable to resolve signature of class decorator when called as an expression.

right after creating a command with sapphire-cli in typescript , the decorator ApplyOptions returns a error The runtime will invoke the decorator with 2 arguments, but the decorator expects 1. is there any workaround for this ?...
Solution:
Enable the experimental decorator option in tsconfig I think
No description

Type safe Slash Commands Options ?

Hi there, I can't seem to find a way to add Type Safe options to a Slash command. See Example: ```ts public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand((builder) =>...

correct way of formatting the bot's uptime

tried with this but it doesn't return the correct uptime
formatter.format(this.container.client.uptime * 1000);
formatter.format(this.container.client.uptime * 1000);
...
Solution:
https://github.com/favware/dragonite/blob/main/src/commands/System/info.ts#L167-179 My bad I misread. Anyway you don't need time utilities for uptime. Just use discord native timestamps. Much much better and much much easier....

ExpectedValidationError from EmbedBuilder().setTimestamp(variable)

(using typescript) while creating an embed in an interaction handler and setting the Timestamp on it, the following Error(s) are thrown ```ts CombinedError (3) Received one or more errors ...
Solution:
classInstance.createdAt is a string

PaginatedMessage, Actions

I am trying to create a paginator with multiple pages (embeds) and so to paginate i want to use buttons ```typescript const paginator = new PaginatedMessage({ template: new FlanticEmbed().setFooter({...
Solution:
fixed it

Issue with Sapphire Update

error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node16'. TS Config ```json {...
Solution:
Update to @sapphire/ts-config v5 and follow the upgrading guide

Subcommands, and CommandGroups/SubCommandGroups

Hey!, I was wondering whether it's possible to create subcommands and groups with sapphire i.e ?automod enable -> enable is part of the automod command group ?automod ignore reset -> ignore is part of the automod command group and reset is part of ignore subcommand group ...

Precondition error

Precondition: ```js const { Precondition } = require("@sapphire/framework"); class DMPrecondition extends Precondition {...

Context Menus not running

When I try to execute a Context Menu, it says "The application did not respond", no errors in console

requiredClientPermissions check always resolving

I tried to get command denied by permission check, but check always been passed. I think problem appeared after this pr https://github.com/sapphiredev/framework/pull/616 . While try to resolve this problem i commented this lines and finally i get correctly missing permissions [ 'BanMembers', 'EmbedLinks' ]. Tested in TextChannel. ```json...

PreMessageCommandRun Event

Is there a way of stopping the command from running as I've tried everything and nothing works

error command sh -c node-pre-gyp install --fallback-to-build

When attempting to run npm i after cloning my bot repo, I get this error. I am currently using Ubuntu 22.04 (LTS) and Node.js 18.17.1 (LTS). This is a fresh install. Below are the relevant logs. https://pastebin.com/2Q3WPWQf...

reload all commands

to reload all commands is it CommandStore.load() or CommandStore.loadAll(), also how much time does it normally take to reload all commands

built-in feature

does sapphire has any built in feature to update the commands without restarting the bot