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

Dynamic disable Slash Command based on role

Is that possible dynamic enable a slash command for a specify role in a specifically guild?

How to get the resolve a key without a target?

👋 Is there a way to access the locale strings using the i18next plugin passing the language instead of delegate it to the fetchLanguage? I'd love to have the nameLocalizations and descriptionLocalizations on my slash commands coming from the i18n json files. That will make it easy to collaborative translation. Something like:...
Solution:
Use applyLocalizedBuilder 🙂 Exemple: ```ts import { Subcommand } from '@kaname-png/plugin-subcommands-advanced';...

creating slash commands

i tried to generate a slash command with cli bot it did not register

No auth data in the request after exchange the Discord code

👋 I'm fowling the built in Oauth2 route documentation but, every time that I fire a request after authenticate I have a null value in the request.auth on the backend side. Here is my frontend code for exchange the Discord code ```ts...

Listeners won't fire up nor slash commands would register in the guild

I created a new bot and now the listeners won't fire up although the bot seems to be online? nor the commands get registered although it shows this

PaginatedMessage extended with editing the select menu options does not work as expected

I am readjusting certain things from my old class to that of @sapphire/discord.js-utilises I have noticed that my old class works as expected but this one does not, it adds another option and if I click it it gives an error new method for the current class: https://srcb.in/Hr0PPd6c7U ...

MessageCreate listener not working as expected

https://github.com/MRDGH2821/Perpetual-Mechanical-Array-Bot/tree/2f7644c2d0d9ebc75ff11ef27f7cc70a33476b70/src/baseBot/listeners/AutoResponse I have some listeners inside this folder, their primary job is to respond to trigger texts (for eg sending FBI word in any text channel will send a random FBI gif in that channel) But for some reason none of them are working....

how to **actually** use discord.js-utilites

i know discord.js and TS but for the life of me i cant figure out what the discord.js-utilities actually does and how to use it to the best of my ability. or am i just stupid...

Recurring Task

Is there anyway i can get my bot to run a task every 10 seconds or so to check if a giveaway is over by querying my mongodb

Global Commands Block for Development Only

How can i set the bot is running only for the developer if setted on development not production without using developer only preconditions because it setted for one per one commands not for the whole bot? Thank you 🙂
Solution:
How can i set the bot is running only for the developer if setted on development not production without using developer only preconditions because it setted for one per one commands not for the whole bot? Thank you 🙂

Can sapphire framework handle edits?

It's a similar concept to what discord-akairo used to have back in the days like your command would be executed if a user edited their message to a command trigger
Solution:
I think some other frameworks fully obfuscate the reply layer but Sapphire doesn't because that then makes assumptions about how you would reply. For example message replies cannot be ephemeral, interaction replies can be. So rather than making assumptions and wrappers for all the different layers we just ask users to implement their own logic. There simply will never be a one size fits all.

extending Command class

How can i make a class called ModerationCommand which automatically checks if the user is a staff member and if not then returns an error so that i dont have to implement the checking in every moderation command file
Solution:
```ts import { Command } from '@sapphire/framework'; export abstract class ModerationCommand extends Command { public constructor(context: Command.Context, options: Command.Options) {...

Preconditions Usage

i read docs but i didn't understand some point my file structure is this...

Permission or Role check with decorators

is it possible with sapphire something like if user has role with id "1098270502058995842" or if user has role "Moderator(Object)"...
Solution:
```ts import type { Message } from 'discord.js'; import { createFunctionPrecondition } from '@sapphire/decorators'; export function RequiresRoleAccess(): MethodDecorator {...

PaginatedMessageEmbedFields select menu

I seem to find myself way too often in this forum, so, here we go again. Is there a way to disable the select menu on this class?

Expected a string primitive when creating StringSelectMenu

Hello devs! caonima
Solution:
but as for the actual issue, you need to set a custom id for the StringSelectMenuBuilder

Problem since upgrading to latest sapphirejs and TS 5.0

After upgrading to the latest version of sapphire, it is raining errors like "ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled." or "A top-level 'export' modifier cannot be used on value declarations in a CommonJS module when 'verbatimModuleSyntax' is enabled.". I amended my tsconfig to this post.
Solution:
oh it seems like it worked to remove the module commonjs line. I will test this, and then close this.

What does sapphire's logger use on the backend?

Winston, pino, something else?
Solution:
console.log/debug/error/warn etc

Broken modals

sometimes my modals are broken idk why sometimes some text inputs doesn't show up...