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
Juan Pablo
Juan Pablo1/31/2024

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
./Ticker
./Ticker1/1/2024

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
Aditya Kirad
Aditya Kirad12/21/2023

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}`,...
Duck
Duck12/16/2023

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) {...
qvgk
qvgk12/12/2023

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.
KAS
KAS12/10/2023

Problem with ChannelSelectMenuBuilder

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

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
Unfragender | Jonas
Unfragender | Jonas11/9/2023

TypeError: Cannot read properties of undefined (reading 'FLAGS')

I need help with my code.
qvgk
qvgk11/8/2023

Making multi-line embed descriptions cleaner

Currently using backticks ( ` ) for embeds but I have to keep them all the way to the left for them to format properly If I put them normally in-line in the code then they look weird and indented on mobile Is there a way to fix this?...
Solution:
``js .setDescription([ Message Link: ${targetMessage.ur}, Message Content: "${targetMessage.content}"`, '',...
No description
MRDGH2821
MRDGH282111/1/2023

Just like there's Member Exit Audit Log, is there Member Join Audit log?

Basically the question. I didn't find any such relevant Audit log type. The closest I could find is MEMBER_UPDATE...
Acier
Acier10/27/2023

Autocomplete api error on vps but not locally

What I'm responding with:
2|Massive-Moderation | [ { name: '@acierdev', value: '234018417043046400' } ]
2|Massive-Moderation | [ { name: '@acierdev', value: '234018417043046400' } ]
Error: ```2|Massive-Moderation | [ERROR] Encountered error while handling an autocomplete run method on command "ban" at path "/root/Massive/Moderation/src/commands/ban.js" DiscordAPIError: Invalid Form Body 2|Massive-Moderation | data.choices[0]: Expected an object/dictionary. 2|Massive-Moderation | at RequestHandler.execute (/root/Massive/Moderation/node_modules/discord.js/src/rest/RequestHandler.js:350:13)...
shadowolf
shadowolf10/26/2023

Command not registering

I've worked on this command about 3 days ago hoping it'd register and it's not registering but all of my other command are: https://sourceb.in/IOy0a5ZSIX Could someone please try and see what I am doing wrong?...
Solution:
Update your Sapphire dependency. ```ts chatInputCommand: { register: true, behaviorWhenNotIdentical: RegisterBehavior.Overwrite...
Gangsterhood101
Gangsterhood10110/24/2023

Discord dashboard

https://sourceb.in/D3ZeMpa8n6 https://sourceb.in/lwjX82jY39 Anyone know how to fix this? make it to where my bot will update its counts when it joines servers Just having trouble with this...
Ravelt
Ravelt10/18/2023

Does ChannelType.GuildText includes categories?

I have a slash command with channel input that I filter to ChannelType.GuildText, but if you search for a category name it will come up in the pop up. Leads to weird behavior since a category is invalid input for the command. I can check for this explicitly in my logic but it seems weird categories show up at all since I would add ChannelType.GuildCategory if I wanted that
conr
conr10/11/2023

Any examples of a table format for an embed?

Looking for a better way to show a table in an embed. I do a hacky way with the code comments but just looking for a better way that's more reproducible. ```md #Rd Pick Team Player 1 1 CHI Connor Bedard​...
Resident Of Prey
Resident Of Prey10/11/2023

help needed regarding prefix handler

hey i have (tried) to make a prefix command handler for my bot, down is my code for it, the bot boots up normally but idk why it doesn't react to the commands messageCreate.js handlePrefixes.js pingPrefix.js...
Alex
Alex10/9/2023

i dont get my code working

i am already struggeling for 3 hours
Bejasc
Bejasc9/29/2023

Authenticated Attachment URLs

Hi guys, For many areas of my bot, embeds access images that are posted into an #assets channel either by me or by select others in my community. The CDN links for these are stored in mongo and referenced again and again, as the embed is sent. ...
WhacK
WhacK9/17/2023

Channel.messages.fetch getting different values

My bot uses the embed fields to match an Array from the embed to their character stats. On Desktop this issue doesn't seem to happen. When testing the submit command from mobile the statRoll message is giving me 2 different values. Sometimes the embeds are there and sometimes they are gone. Everything else looks to be the same. Correct response (no errors): ```ts {...
Resident Of Prey
Resident Of Prey9/12/2023

problems submitting modals

``js const { ModalBuilder, TextInputBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, PermissionsBitField, TextInputStyle } = require("discord.js"); const Fighter = require(../../schemas/users`); const mongoose = require('mongoose'); ...