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

Button error

anybody knows why this is happening? So I have a ticketing system that just stopped working now, for some ungodly reason, closing the ticket takes ages, it will not close it and then error out.
2024-03-30 20:58:07 - ERROR - Encountered error while handling an interaction handler run method for interaction-handler "ticketClose" at path "/home/container/src/interaction-handlers/ticket/ticketClose.js" TypeError: Cannot read properties of null (reading 'delete')
2024-03-30 20:58:07 - ERROR - Encountered error while handling an interaction handler run method for interaction-handler "ticketClose" at path "/home/container/src/interaction-handlers/ticket/ticketClose.js" TypeError: Cannot read properties of null (reading 'delete')
...

Slash Command Error

`node:events:492 throw er; // Unhandled 'error' event ^ TypeError: interaction.isChatInputCommand is not a function...

Invalid Token Error

How do I fix this error: ```js const invalidToken = new DiscordjsError(ErrorCodes.TokenInvalid); ^ Error [TokenInvalid]: An invalid token was provided....
Solution:
you should be using "client.on" or "client.once" for events

Apply Overwrites in a voicechannel

How do i apply overrides after a channel was created?
No description

Create a category and a channel in the category

I try to create a Category and a channel in it, somehow it dont accept the category as a parent ```ts static async createAndRegisterVCGenerator(guild: Guild): Promise<VoiceChannel> {...
Solution:
Review the documentation provided by DiscordJS. Your syntax is wrong. https://discord.js.org/docs/packages/discord.js/14.14.1/GuildChannelManager:Class#create
No description

Bot not starting in VPS

My bot works great on my PC but on my VPS it is not loading.
Solution:
I had to contact my VPS provider (aws) and ask them to give me a new IP address, works like a charm now
No description

commands doesnt work

client.commands = new Collection(); const commandFiles = fs.readdirSync('/root/eye/Eye/Eye/commands/').filter(file => file.endsWith('.js')); for (const file of commandFiles) {...

/twitchadd (name) (link)

name = choice name link = choice value...
No description

A bunch of errors from discord.js's index.d.ts file when compiling

djs version: latest (14.14.1) If needed, I can send my ts-config here. Some notes: - Adding skipLibCheck doesn't help....
Solution:
No more needed, I solved my problem myself, thanks for your attention. The issue was that my TS compiler was outdated (4.9.5) so it didn't fit for the new djs. I updated it to the latest version (5.3.3.) and it solved the issue....
No description

help

keep getting this error not sure how to fix ```RuntimeError: abort(TypeError: fetch failed). Build with -s ASSERTIONS=1 for more info. at process.abort (C:\Users\thoma\Desktop\Emost-Bot-master\node_modules\bumblebee-hotword-node\lib\porcupine-v1.9\pv_porcupine.js:486:11) at process.emit (node:events:519:28) at emit (node:internal/process/promises:150:20)...

User object roles

If a user uses a slash command, is there a guarantee the member object I receive in the handler would be the latest update of that member? I had assumed that would be the case but I'm having behaviour that would suggest the member object I receive does not have the latest up to date information on what roles the user has.
Solution:
Turned out to be user error lol

Getting the deleter of a deleted message

Hi, I'm trying to get the deleter of a deleted message using .fetchAuditLogs() and .entries.first(), but sometimes they don't work... If I were to create a message and delete it, it would show me as the deleter. If I then created a message and then someone else deleted it, it would still show me as the deleter. Then, eventually it would switch and then always show the other person as the deleter. (I tried asking in the DiscordJS server but they always say I'm wrong and don't actually help 😔)...

Make a button executable only by the command executer

Hello, I want to make a button only executable only by the person who ran it. For example, if person A runs command fuzz only they are allowed to click on button B I thought this would work it seems to split out [ERROR] Encountered error while handling an interaction handler run method for interaction-handler "bankButton" at path "C:\Users\Isidr\Documents\GitHub\cobaltia\cobaltia\dist\interaction-handlers\buttons\bankButton.js" TypeError: Cannot read properties of undefined (reading 'id')...
Solution:
I would add userId to the button custom id and regex match it. One way it says you can do it in guide iirc

anyone know how to make bot seem without a status (not online but not offline)

like for @Iriss
Solution:
By not using libraries like discord.js, you'd use a HTTP server instead of connecting to a websocket. @Iriss uses @skyra/http-framework, but discord-interactions is also an option, and the one that's recommended in Discord.js

need help with building dashboard for discord bot

hey, folks I'm building web dashboard for my discord bot using this code I'm gettings all the guilds in which either user can invite or control the bot ``ts const userGuilds = await axios.get(${env.BASE_DISCORD_API}/users/@me/guilds, { headers: { Authorization: Bearer ${token}`,...

Encountered error while handling an interaction handler run method for interaction-handler

Been trying to debug an interaction error and haven't been able to figure out why it's erroring. There isn't a single method on the interaction which is allowing me to edit a reply or send a new one and I am confused. The code I am using is code I'm using on other interactions and it works perfectly fine, so I'm confused. GroupButton.ts button for groups ```ts public run(interaction: ButtonInteraction) {...

Editing an ephemeral reply from an interaction handler

How can I edit an ephemeral reply from an interaction handler? Say that I have ping.js with an embed and a button in an ephemeral message, I want to be able to click that button and then edit the original ephemeral message from pinghandler.js....
Solution:
Read about button interactions and their methods interaction.update in particular.

Problem with ChannelSelectMenuBuilder

THis are my options for it: ```js new ChannelSelectMenuBuilder() .setCustomId('select-ticket-category-dropdown')...

Detect when new message is a reply to another one

Hey! Is it possible to detect when a message is a reply? I have a schedules system that automatically replies to you when you tag a member that's not currently available. I'd like the bot to differentiate between explicit mentions (i.e. @member) and message replies, which technically include a mention too. ...
Solution:
get the referenced message (if one exists), then check the message type to check whether its a reply