Sapphire - Imagine a Framework

SIA

Sapphire - Imagine a Framework

Sapphire is a next-gen object-oriented Discord.js bot framework.

Join

sapphire-support

discordjs-support

old-sapphire-support

old-discordjs-support

old-application-commands-and-interactions

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...

Default guildId for all application commands

Is it possible to set a default guildId for all application commands?

Max Paginated Embeds

What is the max embeds for the Pagination Utility?
Solution:
10 embeds per message, 25 pages total. Limits are set by Discord API

Context Menu Commands Lowercase Name

Hello, I have noticed when creating a context menu command, despite me writing "Warn" as the command name in the code, it appears as "warn" on the actual context menu.
Solution:
Huh. I don't recall that we lowercase it internally. Anyway, you can just change this.name to "Warn"

.loadAll() blocks all shards?

Okay, I have finally isolated my problem which I've opened multiple questions about. The problem is that ```js await client.stores.get('commands').loadAll();...