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

[TAG_FIELD_MISSING]: Field "type" is required to determine the model type.

I am creating a slash command group like so: ```ts public override registerApplicationCommands(registry: Subcommand.Registry) { registry.registerChatInputCommand( new SlashCommandBuilder() //...

Possible Visual bug in the Dashboard?

Hi! So. I just added Sapphire to my server, and I wanted to create a new message template, and the website never shows me the follow-up options, I tried in two different PC's (Thinking it was my laptop) and nothing, is there any solution to this issue?
No description

Global Error Handler

Hello, I want to put a global error handler system on my Discord bot. I would like this system to respond to interactions if there are any. As well as sending a log embed to a chat room. To do this, I used different listeners. On Sapphire events, e.g., Events.ChatInputCommandError It works pretty well. I was able to create this error handler. However, I was wondering if it was possible to have a more global handling to also intercept Discord JS or node errors....

API endpoints

What are the @sapphire/plugin-api built-in Oauth endpoints and what methods do they support?

deserialize string-store snowflake to string

Hey! I just started using @sapphire/string-store, and it seems to make the most sense to store all discord IDs as snowflakes, as they take less space in the custom ID than the string (im pretty sure, right?), however, this means i now need to call .toString() on all the stored snowflakes to use them with the rest of my code (or refactor everything to use bigints instead) Is there some way to have .deserialize automatically turn bigints into strings? or is that functionality that would be worth adding?...

Ready listener doesn't run

Hey, my ready listener doesn't want to run and I don't know why. I'm kind of new to this framework and I copied the most things from the guide. I've attached some screenshots with the relevant code and output....
Solution:
inside package.json, there should be a property called main. make sure its set to dist/index.js because sapphire uses that to determine where your commands/listeners/etc are located
No description

createRepeatedTask(), how?

Any examples on how to create a repeated task? There is nothing in the documentation about it.

Remove Cooldown for a Subcommand while using an external derived class

I get that there are ways to delete cooldowns in actual Commands, and other ways. Even ways to do the same thing with anything extending Subcommand. But I have a problem here, I'm using an external class to keep my code modular and clean, but this raises a problem for me. I can't seem to delete cooldowns from the WeakMap with this setup, and I don't want to have to make the base class extend Subcommand if I don't need to since it's gonna break a lot of things, mainly with how I'm using them (I'd have to pass some extra stuff into each subcommand, which would be less than good). Is there any other ways of doing what I'm wanting to do here? I haven't found any sort of guide on this particular topic, so... If this is a stupid question, I apologize. Also, if I am missing anything in here, let me know. I will happily try to get as much help as I can here....
Solution:
subcommand buckets can be accessed via the following:
this.container.stores.get('preconditions').get('PluginSubcommandCooldown').subcommandBuckets
this.container.stores.get('preconditions').get('PluginSubcommandCooldown').subcommandBuckets
...

Downloading user's GIF posted from favorite GIF Issue

I am currently making a system that automatically download images from links found within user's content. For moderation purpose only! It would seem like some favorite link that are posted don't contain the famous expiration link at the end, but discord loads them anyway with the image preview as if they were perfectly fine. trying to do a fetch on that URL tho doesn't work, same as accessing the URL manually on the browser.. doesn't work. Here's how to replicate:...
Solution:
Alright, I found a solution, altho I'm still unsure of something, I understood at least that we can just wait and refetch a message to get any image URL from the embed's image. I just didn't fully understood they were actual embeds. What I just don't know is how to see the distinction between an URL that creates an embed for say, a website vs an URL that gets replaced with an image embed :shrug: weird. I guess one could check if the embed has a title or other stuff like that to know if it's only an image '^^...

how to fix?

```[ERROR] Encountered error on chat input subcommand "test" at path "/home/runner/workspace/src/commands/test.ts" 613 | * @param method - The method of the request that erred 614 | * @param url - The url of the request that erred 615 | * @param bodyData - The unparsed data for the request that errored 616 | */ 617 | constructor(rawError, code, status, method, url, bodyData) {...

receiving dynamic arguments

im attempting to create a command that has a messageRun implementation. the command should be able to take multiple members and then a duration to timeout the members for. for example, something like @bot timeout @member @member @member 12d this would result in the bot timing out every member for 12 days. but what if i wanted to do something more dynamic like having a custom duration for some members?...

Hosting in a VPS is just not possible (value.replace is not a function)

Hiya! So I have this problem where it really can't be hosted in a VPS, but can on a computer, so if i self host it, then it'll work. I already tried changing the node many times, current latest for the vps is 22, restarted it a lot of times, but no effect....
No description

Can I make a precondition not reply to the user if errored?

I want to make it so if you try to run an admin message command, it will not work and will not return anything, making it seem like it does not exists. I get errors when I leave no message. Let me know :)...

Validation error when importing builders from `discord.js` rather than `@discordjs/builders`

I ended up opening a thread on the d.js server because I thought it was related to it but turns out seems to only happen when used with Sapphire ```ts import { Command } from '@sapphire/framework'; import { SlashCommandSubcommandBuilder } from 'discord.js';...

How can I partition custom id schemas using `@sapphire/string-store`

I created 2 different schema stores, where each store keeps track of schemas for a particular feature of the bot. I then use the parse method of interaction handlers to determine whether a given interaction should be handled by it, as such: ```ts public override async parse(interaction: ButtonInteraction) { const deserializedCustomId = MinesGameQuickPlayConfigurationMessage.customIdStore.deserialize(interaction.customId);...

PaginatedMessage "This maze wasn't meant for you...what did you do." on a user app

Almost (?) the same issue with https://discord.com/channels/737141877803057244/1151938957806940160, but this time on a user app. Trying to run a command in a guild channel but it gets logged saying it came from a DM. Here's some info that might be helpful: The intents and partials ```ts...

A cleaner web experience for this forum

Hey! I saw this forum AnswerOverflow. I’m building Paladin, a smoother, cleaner alternative that makes Discord forums easier to browse on the web. It’s free to use and can run alongside AnswerOverflow, so you don’t have to switch anything to try it out. If it’s helpful, I can spin up a version of Paladin on your forum so you can see how it looks for your community. Is there anything about your current setup you’d like improved? I’d love to see if Paladin can help. 😀 Example Paladin preview attached...
No description

Ping command in the Guide does not work

I tried following the Getting started Guide for Sapphire but it seems like the bot wont register me sending @bot ping in a channel it has access to. I am using Typescript, with the source being in src/ and being built to dist/. My Main property in the package.json is dist/index.js Code should be the exact same. Is there a paste service i can use for samples?...
No description

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

when using bun, is bun supported?
Solution:
sorry, I needed to reinstate node_modules after moving to bun
Next