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
ZZer0-1ne5/2/2024

Error importing a plugin

here is my index.js - https://pastebin.com/3HDUAfVY Here is the plugin I'm trying to import and having an issue with - https://pastebin.com/45Nm9hSf I am not great with javascript, maybe I'm missing something? can someone point me in the right places?...
Ff1fty4/30/2024

Question to Plugin i18next

I would like to start using @sapphire/plugin-i18next. Can i fetch language files from a another repository (or from my own npm module)?...
Solution:
Both yes if you set the path accordingly.
SStealth4/29/2024

Slash Command Decorator

is it possible to use @sapphire/decorators, to make slash commands?
Solution:
the library exports no decorators for it so you'll have to write your own, it is possible to use decorators in general to register slash commands though.
BBalllaz4/29/2024

Serverless

Is possible running on a serverless platform like Vercel, AWS Lambda, etc..??
Ff1fty4/28/2024

eslint autofix problems

Hello, i started using@sapphire/eslint-config for my project. Now i would like to solve these problems. The most erros is because explicit member accessibility. ...
Solution:
no, eslint rules are autofixable only if they provide auto fix functions. These rules simply do not. That's also nothing to do with the config, the config just enables/disables rules. Those rules are provided by the @typescript-eslint/eslint-plugin package (the official eslint plugin for linting typescript files). Notably you can see which rules have auto fixers here for the eslint base and here for @typescript-eslint...
No description
MMathias4/27/2024

Error [UNLOADED_PIECE]: The piece 'ready' does not exist.

Hello ! On this code : ```js import { Listener } from "@sapphire/framework";...
Solution:
you can set a name for the events, so you can name them differently but you can set the "event" property the event you need still that way you can have multiple listeners for a single event...
IIndium4/23/2024

Error please help

```ts import { ApplyOptions } from '@sapphire/decorators'; import { Command, RegisterBehavior } from '@sapphire/framework'; import { send } from '@sapphire/plugin-editable-commands'; import { Subcommand } from '@sapphire/plugin-subcommands';...
Mmallusrgreat4/22/2024

Subcommand Aliases

How can I add aliases to subcommands? Is it not possible?
WWeeskyBDW4/22/2024

Are command instance recreated every time someone use the associate slash command ?

Hello I was wondering : imagine i have a simple ping slash command who return "pong". Will sapphire recreate an instance of my Ping class (who register the command) every time do /ping or not ?...
Solution:
From my understanding; No, they're created at load time and then just saved to the command store and ran through that
Mmk3ext4/22/2024

Promise error sometimes on load - sapphire.js framework

Hey, Whenever I am starting my bot within a docker environment, I am getting this error sometimes; ```2024-04-22 12:04:51 - DEBUG - ApplicationCommandRegistries(BulkOverwrite) Overwriting global application commands, now at 0 commands...
Ff1fty4/20/2024

Caching Problems

Hey, i have some problems with caching, on discord.js they sad All Guilds are cached if you have the intent, and the client is ready. While using intents like GuildMembers & Guilds. i dont know if it fits into this forum, i tough because sapphire initates the listeners.... ...
CCalypso4/20/2024

Registering Context Commands

Hello I want to register a context command with this code : ```js...
Ddavy4/18/2024

Some questions

Hello, I'm new Sapphire and I don't really know how to do the followings. Right now I have 2 issues: 1) I'm trying to understand how could i send an error message when for example someone tries to reuse the /apply command in a timeframe of 30 seconds, right now it will say "the application failed to respond", but i'd like to say something like "you're in a cooldown right now!" and 2) I'd like to understand how collectors really work, what I want to do is when someone answer a question it will send the next one immediately and at the end will send to the user every question+answer...
Solution:
1) See https://sapphirejs.dev/docs/Guide/preconditions/reporting-precondition-failure 2) That's DiscordJS realm, not Sapphire. That said, if you're running a collector inside a slash command you should defer the reply first because otherwise you'll always exceed the 5 second timeout during which you have to reply as per Discord API restrictions. Furthermore, instead of using a message collector you should use slash command options or modals with text input fields, that too is DiscordJS realm (with a bit of https://sapphirejs.dev/docs/Guide/interaction-handlers/what-are-they in case of the latter)...
NNotLogge4/18/2024

Sapphire command not recognized

I'm trying to install and use sapphire CLI but doesn't matter if I use NPM or Yarn 4.1.1, when I install it and try and run sapphire -v I get this back
Solution:
You can only call it that way if installed globally, which yarn berry (V2+) doesn't even do. Run it with yarn sapphire / yarn dlx sapphire instead. Or install it globally, how depends on your package manager (GIYF)
No description
BBaylem4/17/2024

API Plugin Prefix

Hey all, for some reason my prefix isn't applying on the data paths This is my env file: ``` API...
Solution:
disregard, it seems that it was due to something local, I reinstalled all the node_modules and the prefix worked correctly.
Ssecre4/15/2024

Task was not found | plugin-scheduled-tasks

👋🏿 I'm getting "[ScheduledTaskPlugin] There was no task found for "task_name"" error for all my scheduled tasks. Sometimes they run successfully but mostly they giving me this error. There is the code of how i'm declaring task: ```ts import { ApplyOptions } from "@sapphire/decorators"...
Solution:
you should use a different logical redis database for every bot then
VVicente4/14/2024

Can't load subcommand

Hello, i'm trying to update to the latest djs and sapphire versions (from djs v13 and sapphire v3) and I have this structure for a subcommand where I have a file for each subcommand and a index where I declare and import them, before updating sapphire it searched all the files in the folder until it found the index, now it seems it only checks the first file (add) and doesn't load the subcommand correctly. Is there any way to fix this without having to change the structure and declare all the subcommands in one file? Error: ```Error when loading '/var/home/vicente/i/AnnounceIt/dist/src/commands/announcements/add.js': Error [EMPTY_MODULE]: A compatible class export was not found. [/var/home/vicente/i/AnnounceIt/dist/src/commands/announcements/add.js] at _LoaderStrategy.load (file:///var/home/vicente/i/AnnounceIt/node_modules/.pnpm/@sapphire+pieces@4.2.2/node_modules/@sapphire/pieces/dist/esm/lib/strategies/LoaderStrategy.mjs:63:13)...
Solution:
That does not follow the structure for the command nor subcommand loader of sapphire or plugin-subcommands. If you want your subcommnands to be their own files with plugin-subcommands then 1. define them in the root command 2. import functions from other files 3. make sure those files start with a _ symbol (i.e. _add.ts) so sapphire skips them when loading 3. call those functions in the appropiate methods...
No description
Ff1fty4/12/2024

multiplie registered handlers

Hi, is it better to split for example the button interactions for different buttons to different files? Or does it have any complications with the general performance? e.g. if i put everything in one file and fire functions to other files is that better? or does that make no difference...
Solution:
Makes no difference
SSympact064/11/2024

TypeScript Check

Hey. The code works but I am curious if there is any way to do a better coding job like cleaniness etc. Thanks in advance! ```ts // © Sympact06 ...
FFeralheart4/9/2024

Variable parameter type based on the previous variable

I want to add a 'parametric' set subcommand to one of my commands For that command the values can be user, role or a string. Can I somehow change the option type (for example use addRoleOption instead of addStringOption) based on the value of the type option? ```...
Solution:
I think this is possible if you use Auto complete If I'm correct, Autocomplete interaction should be able to give you values of previously filled parameters, which you can use to dynamically present values...
Next