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

Precondition not triggering "chatInputCommandDenied"

I have setup the following precondition:
Solution:
Ah I also see where you're going wrong here. Yes you land on the breakpoint for this.error, however because you're using Array#forEach which accepts a callback function that returns void you're not actually returning this.error for the function chatInputRun but rather for the anonymous arrow function that is provided to Array#forEach. You can solve this by using for...of instead....

Sapphire keeps taking me in circles! Can't access my Dashboard.

Hello! I just added the Sapphire bot to my server yesterday, and I wanted to make a few edits. I headed over to the Sapphire Dashboard on my browser to log in, but I just keep getting taken in circles. I can no longer access my Dashboard. I've tried clearing my cache/cookies for the site. I've also tried logging in on another device with no luck. I'm stuck on the login page that says "You're currently logged in as _" It shows all of the servers that I operate underneath (photo attached). When I click on the server that I'd like to adjust, the page "refreshes" but then stays where it is. So frustrating! Any help would be greatly appreciated!...
No description

multiple idHints for multiple servers

hi, quick question. is this okay if i deploy a slash command in two server, not as global, and have their two idHints be put in the code? ill attach screenshot, just making sure it's all good
Solution:
Yeah
No description

Serializing string-store result inside another schema

I'm trying to re-work customId serialization in my framework, and my plan is to use string-store for this. One of the features in my framework is that you can make customIds that refer to commands, kind of like this: ```ts class MyCommand extends Command { public async execute(i: ChatInputInteraction, meta: Metadata) { const bot = meta.getBot();...

Random date generator

Hello! I know nothing about how to code. What im trying to do is make the bot create a random date when i use like !randomdate or something. Im trying to use chatgpt to help me make the code but i just cant understand it and it wont work. im trying to insert it into the "raw" aspect of message templates

fallback

How i can add a fall back globaly for all RequiresGuildContext ..

Constantly getting "The application did not respond"

Hello, I am constantly getting the "The application did not respond" message. Not matter what I try to achieve the only thing that is fast enough to execute is a simple await interaction.reply('bla bla'). Anytime I try to do something from bulkDelete to sending embeds or creating buttons, I get the thing. Is there anything to try and debug that? Is it possible that my computer is too slow for developing a bot (lmao, it is not that slow though). Obviously defering doesn't do a thing. At first I thought my code was wrong but sometimes it works, sometimes it doesn't... One thing remains, this damn message telling me it didn't respond. Maybe there is a problem with how Sapphire handles my commands right now, found somewhere that a command handler could mess things up and take too long to load up the commands so in the meantime, no response......

@sapphire/type does not work with Bun

Hello! I was trying to get my Sapphire application up and running on my server, however I was greeted with this error: ``` silver-wolf | $ bun src/index.ts silver-wolf | Error when loading '/usr/src/app/src/commands/utils/eval.ts': 17 | var publicField = (obj, key, value) => defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); silver-wolf | 18 | var getFilename = /* @PURE */ __name(() => fileURLToPath(import.meta.url), "getFilename");...

"The application did not respond" on bulkDelete message use

Hello, just built my first slash command, what I coded seems fair though the command doesn't seem to be registered. When writing down / I don't even see my bot appearing (only the built-in stuff). Does the code seem fair? I can't see any major mistake that would make it not register... ```js...
Solution:
More readable code : ```js async chatInputRun(interaction) { try {...

Sapphire not updating the command

I updated the command but it's updating it in discord and when i use it, it reply with a random reply but when i rename it it uploads but the old one still exists...
No description

weird behavior with args.*Result after updating to sapphire v5.3.1

Hello, I have this code (pls see screenshot) available as [p]base64 cmd, this same setup worked perfectly fine when I was on sapphire 5.2.1 but after updating to v.5.3.1 today weird issues like these are popping up. Did something change in @sapphire/result to introduce this change? because it feels like breaking. also I tried to check whats changed between @sapphire/result v2.6.6 ... v2.7.1 but it says 465 files changed and trying to browse it to figure out what changed makes chrome on my potato laptop hard crash, so can someone help me figure out around this issue? thanks....
No description

Pieces Framework Inquiry

@sapphire/pieces Would the pieces framework work outside of a discord.js (or discord related) project? I'm looking to add a module framework for my Electron IPC functions....

@sapphire/plugin-i18next FallbackLng Error

๐Ÿ†˜ Hi, here's the problem I'm having. ๐Ÿ“Œ Can you help me solve this problem ? I have a languages folder with an en-US folder and a fr folder inside....

SchemaStore narrowed to never

Currently trying the example in the readme, not sure if this is a vscode bug but it's narrowing the store's type to never: ```ts import { SchemaStore, Schema } from "@sapphire/string-store"; const Id = {...
Solution:
aka ```ts const Id = { AgeUpdate: 0, StrengthUpdate: 1,...
No description

how to pass variables from one interaction into the next?

this is my current workflow concept: 1. user runs slash command 2. modal pops up, user enters email 3. bot validates email against regex, API service 4. if no account is found on service that matches the email, a message is provided with the option for the bot to create an account on the service on behalf of the user using the provided email...

@sapphire/plugin-api Methods Error

๐Ÿ†˜ Hi, here's the problem I'm having. ๐Ÿ“Œ Can you help me solve this problem ? #๏ธโƒฃ My code :...

Google Cloud Run not logging into the bot

Hello devs, I am using Cloud Run to run a Discord bot docker image built like this: ``` 1. Build...
Solution:
Solved: the problem was not related to Sapphire. I had to allocate a persistent CPU...
No description

interaction.channel is null in slash commands

Hello. I'm sure this is an ID10T issue, but interaction.channel is null for me in my slash commands being used in DMs for my user bot. Am I missing something, like an intent? I'm literally only trying to check if the channel is DMs / DM group or if it's in an NSFW guild channel. Thanks.
Solution:
if you want to do a nsfw command, i recommend you to use nsfw property in builder https://discord.com/developers/docs/interactions/application-commands#create-global-application-command

[email protected] type level problem

just curious what happen here, is my Option usage is wrong? i wanna check is Some is null for retry, because i can't use async inside match or map...
No description

Context Menu not working

I was changing a command so both the message and context menu version of the command were in the same file, however the context menu part doesn't work, and instead returns the "The application did not respond" error. The message version of the command works fine. Relevant Code: https://pastebin.com/Ciqk03at...
Solution:
Add a contextMenuRun to the precontion that always returns this.ok()
Next