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

How do I listen for reactions on all messages in a channel?

doing discord bot dev after a long time. i wanted to listen for message reactions on every message in a channel and run a db query in the run function. but for some reason i can't even get a simple log to work rn. what am i doing wrong here? ```ts // src/listeners/reaction.ts ...
Solution:
Do you have the GuildMessageReactions Intent enabled? And that event only triggers on cached messages so you would also need to enable the partials for reaction and I believe message....

MessageCreate Event isn't working

This is the first listener Im creating I've read the documentation 50 times imo and checked out the examples and I am still confused ```ts import { Events, Listener } from '@sapphire/framework'; import type { Message } from 'discord.js';...
Solution:
you either have to name it messageCreate.<ext> or add a constructor with name: Events.MessageCreate (which resolves to name: 'messageCreate'

NOT WORK SAPPHIRE

why not work bot commands?
Solution:
why not work bot commands?

Reply During Cooldown

Can I make the bot reply with the remaining time of cooldown delay ?
Solution:
but if you wanna specifically get the remaining time:
Reflect.get(Object(context), 'remaining');
Reflect.get(Object(context), 'remaining');
...

messageUpdate event not Triggering

```ts import { Listener } from '@sapphire/framework'; import type { Message } from 'discord.js'; export class roleDeleteListner extends Listener { public constructor(context: Listener.Context, options: Listener.Options) {...

'"discord.js"' has no exported member named 'WebhookEditMessageOptions'. Did you mean 'WebhookFetchM

Error: '"discord.js"' has no exported member named 'WebhookEditMessageOptions'. Did you mean 'WebhookFetchMessageOptions' Project Created with sapphire new - typescript complete I just changed WebhookEditMessageOptions with WebhookEditMessageOptions...
Solution:
<:_:898645160219521134> WebhookFetchMessageOptions Options that can be passed into fetchMessage....

Monorepos

Does Sapphire work and play nice with monorepos?
Solution:
it does, you just have to set it up properly in regards to the cwd when starting a bot

Question regarding slash commands / aliases

Hi, is there a way for me to register command aliases as slash commands as well? For example: Command named one has aliases: ['two', 'three'] Is it possible for the command to be run via all of these: /one. /two and /three? They can have the same description and options....
Solution:
You cannot have aliases on slash commands

disable commands by dashboard.

I want to disable commands through dashboard so, is there any way to dynamically disable commands ?
Solution:
<command>.enabled = false

What is the difference between response.status and response.statusCode ?

When using the API Plugin of Sapphire.
Solution:
Hey, StatusCode is a value, status is a function that assigns the desired status to the StatusCode value...

Hey what is DEVELOPMENT MODE and how do I disable it

I tried setting the Node_Env to something else but it did not change it in the console
Solution:
I seee hmmm

BotList Autopost of stats is not working

I am using the bot list plugin https://github.com/devtomio/sapphire-plugin-botlist I set everything that I need to but it's not updating the stats somehow. Did I miss anything or is this an Issue on the Plugins' side?...
Solution:
Contact devtomio. This is not an official sapphire plugin therefore you won't get support for it on the sapphire support channel.

Miss matching objects on permission setting.

Typescript says that permissionOverwrites does not exits in GuildBasedChannel, even tho it exists, is there a specific way to setup permissions for a channel that i'm not understanding here?
Solution:
See https://discord.com/channels/222078108977594368/769862166131245066/1076213839990894604 Use !isStageChannel(channel) (function from @sapphire/discord.js-utilities) to eliminate the StageChannel type...

requiredClientPermissions check always rejecting

While requiredUserPermissions: ['ManageRoles'] works great. The client check requiredClientPermissions: ['ManageRoles'] seems to always block. It is throwing not a specific missing permissions error but an I was unable to resolve my permissions in the ${commandType} command invocation channel. Unless I am doing something wrong, it looks like the problem is that the check is referencing the application id channel.permissionsFor(interaction.applicationId) when it should be referencing either the clients guild member or user ID. https://github.com/sapphiredev/framework/blob/179b21e7f74c4d9a506e1be98d7487f939ec0ae7/src/preconditions/ClientPermissions.ts#L71...
Solution:
Closing this as the fix has been released in v4.2.1

Unable to get member data from users that have left / kicked

Hi, I am trying to get data from members who have left the discord server or have been kicked. But I keep getting undefined errors and I am unsure why here is my code. This only happen in sapphire ```ts @ApplyOptions<Listener.Options>({ event: Events.GuildMemberRemove, name: 'Handle Guild Member Kick/Leave' })...
Solution:
1. Unrelated to Sapphire 2. You're implementing the event parameters incorrectly, see https://discord.js.org/#/docs/discord.js/main/class/Client?scrollTo=e-guildMemberRemove...

Catch all chat input command errors listener

Hello ! I tried using the Events.ChatInputCommandError listener to catch any errors thrown by the chat input command, but it never seems to catch any errors. Am I missing something?...
Solution:
Because the error is thrown in a subcommand and it is not the same event... See https://www.sapphirejs.dev/docs/Documentation/api-plugins/modules/subcommands_src#subcommandpluginevents...

Multiple Clients on one file/instance

I was wondering if its possible to run multiple clients on one file (i.e. .forEach()-ing new Client())? I tried a basic implementation and the commands we're spammed after running one once (see screenshot)...
Solution:
Absolutely not, Sapphire interacts with container which exists as a singleton (only one instance). I don't know why you want to do this, but worker threads or forks are your only way....

How to present Slashcommands?

How can I present the Slashcommands of my bot in his About Me like for example carl.gg does?
Solution:
your bot has to be verified, then it's automatic you dont configure it...

Interaction Handlers

Am I required to specify to sapphire where my interaction handlers directory is? A interaction-handlers directory doesn't seem to be detected. - ├─ Loaded 0 interaction-handlers....
Solution:
For AnswerOverflow: sapphire auto detects the interaction-handlers directory

bot won't get on and connect to discord.

hi, my bot won't turn on. i've coded a lot of bots before with sapphire and they worked just fine, decided to make a new project, coded the structure and everything good but when i run my "yarn watch:start" - "watch:start": "tsc-watch --onSuccess \"node ./dist/index.js\"" it just won't turn on....