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

Cog Actions

So, my bot is running the cog-like system. However, I was wondering if there was a way to run actions on the entire cog. For example: Unloading the cog Loading the cog ...
Solution:
first of all I will assume you followed https://www.sapphirejs.dev/docs/Guide/additional-information/implenenting-a-discordpy-like-cog-system If you did then just like how you call register you can also call deregisgter https://www.sapphirejs.dev/docs/Documentation/api-pieces/classes/StoreRegistry#deregister Alternatively you can loop through all the stores held in the particular StoreRegistry (cog) and call store.unloadAll()...

Is there anyway using Subcommand plugin with Slash command

Seem like chatInputRun is not exist on SubCommand

Reload Command

I'm having trouble making a reload command, I've tried so many things... I'm using CommandStore to do this (load and unload modules) If anybody could provide an example of how to do this, that would be amazing ...

Vebose Child Folder not register slash command

room-member.js will not trigger registerApplicationCommands

Happen Issue when try to watch:start with examples

I meet this issue when trying to clone example and watch:start

Type '"Rules"' is not assignable to type 'PreconditionEntryResolvable'.

Type '"Rules"' is not assignable to type 'PreconditionEntryResolvable'. src/preconditions/Rules.ts: ```js export class RulesPrecondition extends Precondition {...

Custom Hook before a Piece being called/run

Is there something like beforeRun hook where we can register custom function to be called. I'd imagine something like a middleware before the piece messageRun or chatInputRun being called. What I'm trying to do is to add a logger that is able to read the piece name and it's message/content. Currently doing it by adding the code right on the beginning of the run function, in which is not efficient and easy to forget.

@sapphire/ts-config compiler options

Having some issues trying to use this library, Whenever I try to compile I get this warning:

Getting the HTTP status code of a @sapphire/fetch request

Title says it all basically, I need to know the status code of an api response for error handling

Register ChatInputCommand

when i set the guildIds option to ['1076805694285680750'] it returns an error: ```ts ExpectedConstraintError > s.string.regex Invalid string format Expected: expected /^[\p{Ll}\p{Lm}\p{Lo}\p{N}\p{sc=Devanagari}\p{sc=Thai}_-]+$/u.test(expected) to be true...

Cannot find node_modules/@sapphire/type/prebuild/type-node-v115-linux-x64-glibc-2.37/type.node

Bot generated using the Complete Template from the CLI, getting this error. Not sure what it means or what to do. Error occurs when loading the eval command shipped with the template. https://pastebin.com/i2rwjzYV

Fetch Utility File Structure

Hi! I have a project created with the CLI's basic template and I am hoping to add API connectivity using the fetch utility. Where should I put the code to fetch data from the API? Should it go directly in the command file that it is relevant to, or should it be separated into a different file? Thanks for the help.

Plugin API - Cookie Not Setting

Hello, I am having an issue where the cookie for OAuth2 authentication is not setting in the browser, this is in a production environment. Here is my config: ```js {...

Paginated messages page limit

To get around the 25 page limit, is there a way to have the class just send up to three select menus if needed, raising the max to 75?

Seeking for Guideline

I have used discord commando (command handler) for a while (1.5 years ago), since commando is no more available. I want to migrate in sapphire (refereed). I need a guideline...

Property 'run' in type 'ScheduledTaskErrorEvent' is not assignable to the same property in base type

``` #16 [builder 5/5] RUN npx tsc #16 9.480 src/listeners/tasks/scheduledTaskError.ts:10:9 - error TS2416: Property 'run' in type 'ScheduledTaskErrorEvent' is not assignable to the same property in base type 'Listener<"scheduledTaskError", ListenerOptions>'. #16 9.480 Type '(error: Error, task: string, _duration: number, _payload: any) => void' is not assignable to type '(error: unknown, task: string, payload: unknown) => unknown'. #16 9.480 ...
Solution:
Update the Dependencies Change run Arguments -> public run(error: Error, task: string, _payload: unknown) ...

Multiple CORS Origins

Hello, With @sapphire/plugin-api, can you define multiple CORS origins? If so, how would I do this? Because using "*" still gives me a CORS error in browser and I can only define 1 origin by looks of things in the config....

Ready Listener doesn't work

```js import { Events, Listener } from "@sapphire/framework"; export class ReadyListener extends Listener { public constructor(context: Listener.Context, options: Listener.Options) {...

Register/delete guild commands on call

As the title already should explain my question but here I go in depth: Is it possible to register/delete guild commands on a specific guild in the runtime?

Bot doesn't trigger error events

I want to add error reporting to my bot and to test it I added two errors to my bot: a manually thrown one (calling throw new Error('You've got an error!');) and an E500 (in this case checking a property of a null object) I've added the ```...
Solution:
define bad commands. At any rate, Sapphire has its own error handlers. Check the Events constant we export. Events.ChatInputCommandError Events.ContextMenuCommandError Events.MessageCommandError and more...