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

Manual Scheduled Task Method Arg Number mismatch with documentation

It's pretty simple: Documentation fo ScheduledTasks plugin says container.tasks.create has 3 arguments as stated in the github readme (https://github.com/sapphiredev/plugins/tree/main/packages/scheduled-tasks): - task – The task to be scheduled. - payload – The payload for the task....

messageCommandDenied preventing bot from booting

Hello, I'm using the basic messageCommandDenied code provided in the sapphire docs and it has been working up until today but upon booting up one of my bots I get the following error: ```src/listeners/messageCommandDenied.ts:15:27 - error TS2339: Property 'send' does not exist on type 'DMChannel | PartialDMChannel | PartialGroupDMChannel | NewsChannel | StageChannel | TextChannel | PublicThreadChannel<...> | PrivateThreadChannel | VoiceChannel'. Property 'send' does not exist on type 'PartialGroupDMChannel'. ...

sapphire problem with types

I decided to update packages and now I'm getting those errors (img 1) Typescript version 5.6.2 Versions for all sapphire packages that I have are visible on screenshot...
Solution:
Downgrade to ~5.4.5 Mind that tilde. It's important. 5.5 and above require a merge of https://github.com/DefinitelyTyped/DefinitelyTyped/pull/69997...
No description

User App

Hey, does sapphire support user installable applications? And if yes, is there any guide or is it just pretty much the same?
Solution:
not yet. DiscordJS released user apps only a few days ago. A sapphire update hasnt been released yet. If you claim "ping me for announcements" through <id:customize> you will know when we post about it in #Announcements

Support for bun

Does sapphire support bun out of the box? While trying to run the code (without compiling, aka directly through bun) I get multiple errors saying a compatible class export can't be found... I'm assuming this means the code has to be compiled first but If I'm wrong let me know.

TypeError: Cannot convert undefined or null to object

I get this error after trying to run my build (Typescript) - it only happened when I updated my typescript package to 5.5.4 ``` C:\Users\Lemons\Documents\GitHub\Pixie-beta(typescript)\node_modules@sapphire\shapeshift\dist\cjs\index.cjs:2765 this.enumKeys = Object.keys(enumShape).filter((key) => { ^...

Complete Temlate Error

Created a new Project via CLI (used the complete template) didnt chagned anything and cant run the project now, becuase of this error: ``` src/listeners/mentionPrefixOnly.ts:8:26 - error TS2339: Property 'send' does not exist on type 'DMChannel | ...' Property 'send' does not exist on type 'PartialGroupDMChannel'....
No description

Discordjs and TypeScript typescript error

Hello, someone else has this same failure, all the embeds in the send section are failing, the bot was working fine until a few hours ago.
No description

serialize a bigint Plugins

``` 2024-09-03 11:22:15 - FATAL - TypeError: Do not know how to serialize a BigInt 2024-09-03 11:22:15 - FATAL - at JSON.stringify (<anonymous>) 2024-09-03 11:22:15 - FATAL - at _ApiResponse.json (/home/x/SwBot/node_modules/@sapphire/plugin-api/dist/cjs/lib/structures/api/ApiResponse.cjs:101:75) 2024-09-03 11:22:15 - FATAL - at [HTTP-GET] (/home/x/SwBot/dist/routes/answers.js:20:25)...

Overriding message command listeners

Is it possible to virtually load a piece (listener) to override the default CorePreMessageParser? I'd prefer not to do this by adding it to my listeners folder but rather in my command manager

Fetch not calling JSON.stringify for body objects.

Hey, i'm currently using @sapphire/fetch and trying to send a POST request for a API with a object on the body. The thing is: the object is not being stringified and the API is receiving [object Object]. I went through the @sapphire/fetch source code and, apparently, the function that determines if a body should be stringified or not (shouldJsonStringify) is returning false for my object. (https://github.com/sapphiredev/utilities/blob/main/packages/fetch/src/lib/fetch.ts#L191-L208) And just to make it clear, the object that i'm trying to send is in fact...a object, because using typeof theObject returns object lol, but its doesn't have a toJSON function or a Object constructor, in fact it has a [Function: Object] constructor, which is not included in the shouldJsonStringify function....

preconditions implementation

So i have some preconditions that check the database if the user is a staff or something. but each of them fetch the database, and it's useless to do 3 requests for the same data can i somehow specify some data to the precondition or is there a way like i fetch the data on the interaction run the run the preconditions?...

File Names

So I was told to ask this here; I am working on a slash command that is supposed to have the same name in multiple guilds but perform different functions, can I use the same name for the file names if they are in different folders for different guilds or? Hopefully that's understandable what i'm trying to ask. I have made a similar question before but this one is about whether the names can be the same of the files.
Solution:
yes, but you'll have to set the name property in the options in the constructor / ApplyOptions. Furthermore, you will either have to use bulk overwrite or be very sure that you're tracking idHints otherwise you'll get name clashes when Sapphire attempts to do a comparison analysis to check for new data

Coodown

Can i reset the cooldown for a specific command for a specific user?
Solution:
not with the built in cooldown. You will have to make your own precondition.

How do I make my bot "greet" a new member?

So I have this projeect structure. ``` src/ commands/ ping.js - WORKING command...

build version not working

i've used typescript to make the bot and after building it using tsc, it said 0 commands found, like no commands available to use. so i just need the dist folder for production, right? do i need .sapphirerc.json too? or anything else am i missing?
Solution:
nvm sorry for opening this post. the answer for my question is already in another post my bad i should've read other posts before opening one.

Why is ActivityType.Custom excluded from the presence ActivityOptions[]?

See code here in index.d.ts: ```ts export interface ActivityOptions { name?: string; url?: string;...
Solution:
Update: the exclusion has been removed and typescript is no longer mad at me. ```ts export interface ActivityOptions { name: string; state?: string;...

node_modules eror

node_modules@napi-rs\canvas
No description

Using sapphire paginator is it possible to customize the pages names ?

Solution:
```typescript import { PaginatedMessage } from "@sapphire/discord.js-utilities"; import { Command } from "@sapphire/framework"; import { inlineCodeBlock } from "@sapphire/utilities";...
No description