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

ChatInputCommandError Event not firing

I'm having trouble with this code https://hst.sh/odutopaniv.typescript in that the event is not firing when a command errors and this is being logged by sapphire natively https://hst.sh/ivezicirex.apache
Solution:
This appears to be an issue yes but I currently do not have the time to look into it. For now I recommend splitting across files and just calling the same external function: https://github.com/sapphiredev/gemboard/tree/main/src/listeners/commands

What does commandError emit?

I'm struggling to find what commandError emits when fired by sapphire.
Solution:
A chatInputCommandError event emits a ChatInputCommandErrorPayload

Am I doing this wrong? I feel like I'm doing this wrong.

Hey there, In my ping command I'm doing void interaction.reply(await resolveKey(interaction, "ping:success", { ping })) because I'm using eslint and it is screaming
Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator.
Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator.
when not using void. Is this a good way of handling the eslint error or is there a better one. resolveKey is from @sapphire/plugin-i18next and the eslint config is from @sapphire/eslint-config....
Solution:
interaction.reply returns a promise. It just be that way. Either await it, or if it's last in the command then return it.

Button handler not triggering

Heyah @Helpers I basically added a button handler from https://www.sapphirejs.dev/docs/Guide/application-commands/interaction-handlers/buttons in /listeners and changed the example's button ID with the one from ```ts const buttonRow = new ActionRowBuilder<ButtonBuilder>().addComponents( new ButtonBuilder() .setCustomId("foo")...

How to make auto idhints?

so i want to make automatic idhints adding like idHints: [this.id] but i think it doesn't work so how i can make it auto?...
Solution:
There is no automatic idHints. You are completely misunderstanding what idHints are for. Read https://www.sapphirejs.dev/docs/Guide/application-commands/application-command-registry/registering-chat-input-commands#idhints again In short idHints are used before commands are even registered (and this.id would be available) to diff files against API data....

Issue on upgrade to v4

On loading like any file (listeners and commands) it spits out a TypeError: import_discord2.Permissions is not a constructor error and doesn't load it.
Solution:
wait, i didn't update decorators

Namespace 'Command' has no exported member 'ChatInputInteraction'.

Hey there, I'm following the guide at https://www.sapphirejs.dev/docs/Guide/getting-started/creating-a-basic-app-command, and I'm getting the error Namespace 'Command' has no exported member 'ChatInputInteraction'. on this line. ```ts public async chatInputRun(interaction: Command.ChatInputInteraction)...
Solution:
Yeah that was changed today in v4. You should use Command.ChatInputCommandInteraction

Dockerfile - CLI Template

If I'm using yarn v3 do i enable line 23 + 27-28 or just 27-28?
Solution:
If you're using Yarn v3, then you copy the yarn.lock, the .yarnrc.yml, and the .yarn directory, as they are in your screenshot

Subcommands Typings clashing after updating.

```ts src/lib/structures/PrismSubcommand.ts:27:51 - error TS2694: Namespace '"C:/Users/jacob/Documents/GitHub/THE-PRISM-V4/node_modules/@sapphire/plugin-subcommands/dist/lib/Subcommand".Subcommand' has no exported member 'ChatInputInteraction'. 27 export type ChatInputInteraction = Subcommand.ChatInputInteraction & { ~~~~...

Send message to specific channel from slash command

I'm so sorry for having to ask this, but... how do you send a message to a specific channel from within a slash command? I believe I'm missing a huge gotcha here.

Cooldown Message

Is there a way to display a custom cooldown message after a cooldown limit is reached?
Solution:
TL;DR: see https://www.sapphirejs.dev/docs/Guide/preconditions/reporting-precondition-failure, get the remaining amount from error.context. Then send custom messages.

What's the best way to watch for activity changes on a channel

Hello 👋 I would like to know what's the best way to develop temporary text and voice channel based on activity. I was going to listen to the message* or voiceStateUpdate events (based on channel type) to update in a database their last activity, and at the same time send an event to warn that a new activity has been detected and thus restart the counter before deleting. However, an implementation like this one seems to me too heavy: retrieving each time the linked resource from the DB, updating it, always have a counter running, and that for each monitored channel....

Set ApplicationCommandOption max value to be a function

For a "page" option in a command, I want to set the max value in the options rather than checking after the user run's the command. Is there any way to do this?

Best way to make ButtonInteractions persistent after restarts?

I'm just wondering if there are any built in ways, or ways you might make button interactions persistent over restarts. I'm trying to make a page up/down button, but having a separate listener/collector means that 1. I have to figure out the current page of the message afterwards. ...
Solution:
but youll have to do something with permanent storage i.e. through a database

build error

I can build my project, and the error come from the framework (i use nodejs v18)
Solution:
Install @types/node

Getting the client to log a list of registered commands and if they are global

I was just wondering if there was a way, once the ApplicationCommandRegistry finished initialising, I could get the registered command data?
Solution:
client.application.commands, discordjs code

PaginatedMessage autodelete

Heyyy, Is there a way to auto delete PaginatedMessage after it has been closed ?...
Solution:
extend the class and overwrite the handleEnd method

Message Components Disappearing?

I have the weirdest issue. I'm using pagination from @sapphire/discord.js-utilities, but sometimes message components don't show up (although you can see "1/2" in the footer, and there are definitely supposed to be 2 pages). Example in the first image. But then I found some matrix shit, because I took the second image as a screenshot (with message components) 5 hours ago. I check the message now, and the components disappeared, without leaving a (edited) label behind (see third image). ???...

Modal Submit Preconditions

how could i use preconditions on interactions of type modalsubmit?
Solution:
Use an if statement in your parse method

BOT don't catch commands

my bot don't catch commands, what i try to mean is that when i use for example: -ping command it doesn't say anything, i don't know what i'm doing BAD 'cause i'm watching a video, can someone help me? please <:clown_sob:765318460241870920> index.js ```js const { SapphireClient } = require("@sapphire/framework");...