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

Sapphire preconditions args error

When ever I try to run a precondition, I get this, any ideas on how to fix it?

Custom prefix

How can i implement custom prefix per guild i already have my command which is >prefix <new_prefix> and is saved in mongo but i dont know how can i set it for this server and get the prefix and there is no even of prefix commands here.

Handling argument autocomplete per command

Would it be possible to handle autocompletes through the Command class itself instead and it will be handled accordingly by the interactionCreate event?

Weird error when installing ts-config

image includes the error
Solution:
misspelt my node-linker lol

API error event handler

Hi, when I get a DiscordAPIError through the logger that starts like this:
Encountered error while handling an interaction handler run method for interaction-handler
Encountered error while handling an interaction handler run method for interaction-handler
Is there a singular event to capture these without listening to multiple events such as chatInputCommandError, commandAutocompleteInteractionError and contextMenuCommandError etc?...
Solution:
there isn't but you can easily reuse code. Just import the same function in each listener and pass parameters.

Localizations for slash commands working partially

I'm trying to utilize i18next-plugin for registering slash commands using Discord's localization, but it doesn't seem to work properly. Command names/descriptions and option names are still English (the default, non-localized values) while my client language is Russian. Everything else is localized correctly. Here is my code: ```ts new SlashCommandBuilder() .setName(this.name) .setNameLocalizations(allLocales("commands/buy:name"))...

i18next plugin without namespaces

Hello, how would I get rid of the namespaces, and have it like this? I get invalid language provided now. ```ts i18n: { i18next: {...

UnknownMessageCommandName event is not working

So i was making the event but when i run >pinewfweew for example or any other wrong command nothing appears in the console. ```ts import type { UnknownMessageCommandNamePayload } from '@sapphire/framework'; import { Listener } from '@sapphire/framework'; export class UserEvent extends Listener {...
Solution:
Change the event to Events.UnknownMessageCommand. You'll need to add Events to your @sapphire/framework import

can i edit the frame work to apply custom commands or not.

So i want to edit the frame work to make it able to handle custom commands i am using mongo db for the data storing of custom commands. Is it possible if yes how can i do it

Embed Paginator

May i ask something about embed paginator? it works when i doesnt send my message as ephemeral but when i send my message as ephemeral i always got a interaction already replied or deferred or Uknown Messsage error.

Getting ChannelType from APIInteractionDataResovledChannel

I'm currently trying to work with chat input commands. And when I create an channel option and use .getChannel() to retrieve it. The return type has APIInteractionDataResolvedChannel which can't be used with methods such as isTextBasedChannel() is there something I am doing wrong? I've checked the documetnation and APIInteractionDataResolvedChannel is not in the ChanelTypes typedef.
Solution:
You should use the discordjs methods to resolve slash commands parameters

idk what to title this.. trouble shooting? im new to all of this haha

Trying to make a /role command with options that on different slected options it either adds or removes role.. this code looks normal to me (yet im new at this so i could be missing something... my code is pasted in link below as its too much for discord. i get no terminal errors only a "The application did not respond" https://pastes.dev/1pAxZoEZuW...

interactionHandler parse showing TS '...cannot be named without reference to...' error

When attempting to make a very basic interaction handler I'm getting the pictured compiler error. The guide suggests that I shouldn't need to explicitly type the parse function so I'm not sure why I'm getting this error. The code: ```ts import { ApplyOptions } from '@sapphire/decorators'; import { InteractionHandler, InteractionHandlerOptions, InteractionHandlerTypes } from '@sapphire/framework';...
Solution:
Summary for Answer Overflow: The issues was caused by pnpm (the package manager I was using) using symlinks for @sapphire/result. Hoisting all sapphire packages did not help. Switching to yarn in place of pnpm has solved the build issue.

Can i create an Auto Changing Status For My Bot?

Can anyone help me out?
Solution:
discord.js.org

Read property from custom Command Options

Hey folks, I have a custom command options object, that contains a property called shortDesc. I want to read a property from the options, inside the registerApplicationCommands method, so that I can not have to provide this value (Get a random trivia question) twice. ...
Solution:
First of all, the reason it works in your help command is because you're using command.options, likewise if you use this.options.shortDesc it'll also be there. Secondly, categories are built into sapphire so whatever you're setting in the constructor there is pretty pointless. That dates back to a very old by now version of Sapphire where categories weren't integrated Thirdly, Sapphire Command class has a detailedDescription option which can be an object of whatever you want and is set automatically so you do not even need custom properties for this at all. Just use module augmentation to modify the interface for detailedDescription then use ...

TypeError Class constructor _SapphireClient cannot be invoked without 'new'

This is happening when I extend SapphireClient. Using Typescript.
Solution:
This means your target wasn't set so it defaults to ES3 which is ancient JS that isn't supported and doesn't supported classes

Is there a recommended way to split subcommands across multiple files?

Perhaps another way of phrasing this question is: Can I have arbitrary typescript files in the commands directory without breaking things?

Does sapphire support all the up to date Discord Auto moderation stuff?

Title
Solution:
most probably this is discord.js related and not sapphire related

How do subcommands work with idHints and guildIds?

How do subcommands work with idHints and guildIds?