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

MAYBE a bug with subcommands

/
Solution:
oh, going through src I figured that event's name must be PluginMessageSubcommandNoMatch

oauth guide

might be a pretty dumb question, however, is there any version of oauth guide that is just so plain, a mind like mine can comprehend? I just for some reason need an example to see how it should work, if there is any. Anything helps. Tried plugin-api's documentation but for some reason I can't make anything work.
Solution:
yes you're describing the basic principle of OAUTH2. Like I just said, it works in 1 and 1 way only.

What am I supposed to trust, the basic slash command registering? Or the Wiki's Commands section?

Stuff under Creating a basic slash command seems to be heavily outdated, it says the type is Command.Registry in some parts, but vscode is never actually auto completing to that. Instead it auto completes to ApplicationCommandRegistery type, and Awaitable stuff as the return of registerApplicationCommands, it started to be totally different approach here, then I saw fetchReply is also outdated, and the new one, which is withResponse is no where similar to be usable in isMessageInstance, is it ba...

disable specific commands from registering on startup

hi, so i'm not completely sure how to implement this, but i have a config with all the command names, with an option to enable or disable them. how would i go about actually implementing this so that it doesn't register the command on the registry at all if the command was set to disabled? thanks...

Required Client Permission mismatch with role

One of my commands requires various authorizations and, among other things, Connect. So I pass this array ```js const RequiredBotPermissions = [ PermissionFlagsBits.Connect, PermissionFlagsBits.CreatePublicThreads,...

application commands

I used default guild ids but still getting global commands in console

Can't see blue color in terminal

I copied the code from logger plugin and made some changes to add an "actor" property for my convenience. If I pick Pterodactyl as the actor, it should display in the console with a red color. If I pick Discord, it should have a blue color. Pterodactyl appears as red color just fine, but Discord doesn't seem to have any color at all. Here's the code: https://github.com/mallusrgreatv2/disactyl/blob/logger/src/lib/logger/LoggerLevel.ts#L60 I also added a console.log directly using blueBright() from colorette, and that seems to work fine....
Solution:
This problem isn't really related to Sapphire because this is 100% your code and your own plugin. Since you're essentially making your own logger plugin, even something like the console.whatever is in your own code: https://github.com/mallusrgreatv2/disactyl/blob/52e62d2f5d864bad409d63954cbb69a195999994/src/lib/logger/Logger.ts#L88. You'll have to fix this on your own since it's so very specific to your own desires for the logger. As for the location of the file, that's fine. It's pretty much free style, only it's recommended to not put it in root because that trips up GitHub's license detection....
No description

Plugin API

So Im willing to start doing a little experimentation with websites and calling the endpoints. Ill just be concise: Is Plugin API a thing thats supposed to expose endpoints you can call from your websites? Same goes to oauth, can it handle more than one oauth? Also can I create any endpoint or are there any limitations. Sorry, as much as I know sapphire well, I never played on the website league...
Solution:
yes, yes and yes

Command option - Array of users

Hi, i'm working on a slash command for my bot which will allow a user to create a loot-split for the group they're playing with. I need to be able to create an option (argument) for my command which will take multiple users, but I cannot see how. Is this possible? 🙂

Failed to overwrite global application commands: Command name is invalid

Hello! I am having an incredibly frustrating time adding a new slash command to my bot. The command is fairly straight forward however when I try to start the bot I get the error in the title. I cannot for the life of me seem to work out why it should throw this error and was hoping to find some helpful advice here! ```
[email protected] start node dist/index.js...
Solution:
I found the issue, its not only command names that need to be lowercase, its also argument names or option names too
No description

use wildcard paths on InteractionHandlerStore#registerPath

Hi, are we able use wildcard paths while registering a new path for a store? or is their away to do this without writing a helper for that for example:
this.stores.get('listeners').registerPath(join(this.rootData.root, './handlers/events')).registerPath(join(this.rootData.root, "./integrations/**/*"));
this.stores.get('listeners').registerPath(join(this.rootData.root, './handlers/events')).registerPath(join(this.rootData.root, "./integrations/**/*"));
...

Interaction Handlers & "Button is not for you" response

Hi! My problem is: I have a bunch of buttons that implemented like interaction handlers, and my goal is simple - I want to respond to a user with "This button is not for you" if "parse" method fails. But I can't do that because if I respond to 1 handlers, others will break with "interaction already replied". Is there any sort of and event if sapphire couldn't find any parse method that will work so I can response with my message? Another solution I think of is just respond with any handler, and before responding check if interaction is replied. If it is - do nothing, but then - we need to handle replied interaction in our "run" method. Tbh adding this small feature feels like a pain so I don't even know if I wanna do that if there is no simple solution :D...
Solution:
Truth be told I would advice against it anyway because it goes principally against how Discord tells us to use interactions. Interactions should only be replied to once. The only consistent way to achieve this is to use something like discordjs' awaitComponents where you can user filter instead of sappire handlers. An example of this can be seen in PaginatedMessage i.e.e from @Dragonite

VoiceStateUpdate

help, im experiencing an issue where the newState object in the voiceStateUpdate event is either returning as 0 or not returning a VoiceState object at all. also oldState only returns something...

Problems with plugin api

Hey! I'm attempting to setup my bot with the plugins api. I've managed to make a route but whenever I start the bot I have no indication of the api starting. I've checked this.container.client.server.server.listening, which returned true and I also listed routes through the container. The problem i'm having is whenever I attempt to send a curl request or a web request to the url I get a connection refused error....
Solution:
you have to put listenOptions in the api object

Timestamp problem

Hi there! I'm using Timestamp from the time-utilities (latest) to convert a duration in milliseconds to a timestamp like this: ``` const timestamp = new Timestamp('HH:mm:ss');...

Is there a better way to handle both message and slash commands?

Docs say that you have to override messageRun method to handle message commands and override chatInputRun for slash commands. This leads to unnecessary code duplication, since logic would be mostly the same. discord.py or serenity expose something like hybrid commands , so you can write a single handler for any interaction, is there an equivalent for Sapphire?...
Solution:
just extract most logic to a separate function and call it from both, i.e. the ping commands from sapphiredev/examples repo

I have use @/ as Root

I have used @/ as root but now it doesnt finds the modules I'm not sure how to fix that anyone that can help me out?
Solution:
setting it in only tsconfig isnt enough. Ts doesnt recompute paths when compiling. Either use NodeJS built in submodule imports and switch to # instead of @ in the process, or use something like the module-alias package.
No description

Is there a way to make an Event (registerApplicationCommands) 'wait' before triggering?

Okay so I created a handler named unregisterer.js I'm calling it in another handler named bootstrap.js bootstrap.js is then imported into index.js then called as such await handlers() on ready event I use a custom structure named SlashCommand imported in every command file (to replace Command of @sapphire/framework): this only serves to prevent spamming registerApplicationCommands in every single command file...

SubcommandErrorEvent how to?

I have this code for defining listener for subcommand error event ```typescript import { ChatInputSubcommandErrorPayload, SubcommandPluginEvents,...
Next