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

Removing pagination buttons on last page

Hi there, what is the recommended way to remove the pagination buttons on the last page when using the paginator in sapphire djs utilities?
Solution:
at any rate, use setPageActions and set the index (second parameter) to the last page index then pass an empty array I think

Error when loading events

Hello ! I'm creating a Discord bot with Sapphire and when I create an event, I have this error : Error when loading '/home/desk/bot-sapphire/common/src/ticket/listeners/ready.js': Error: Dynamic require of "/home/desk/bot-sapphire/common/src/ticket/listeners/ready.js" is not supported...
Solution:
Ok I undertstand ... I don't use .mjs extension on my file ... But I don't understand here : https://github.com/sapphiredev/pieces/blob/main/src/lib/strategies/LoaderStrategy.ts#L73 How does it work ? If I use ESM, we should use import() instead of require(), no ?...

Command Preconditions

Is there a way to check what preconditions a command has applied?
Solution:
this.options.preconditions or replace this with however you got the Command instance @D24

error TS6053: File '@sapphire/ts-config' not found.

I'm trying to add jest tests to a project and I started to get this error. ``` Error: Jest: Failed to parse the TypeScript config file jest.config.ts TSError: ⨯ Unable to compile TypeScript:...
No description

Slash commands are not being registered when using Bun

Hello, I'm having trouble running the framework with bun because the slash commands are not being registered. I created a new empty project with bun init and then installed discord.js and @sapphire/framework My index.ts file, which is the entrypoint, looks like this:...

What is the event name for when vanity gets updated?

i tried looking into guildUpdate but it's not there
Solution:
You could fetch the audit log in the guildUpdateEvent Or you could use the auditlog event...

Typescript error on trying to use fetch

node_modules/@sapphire/fetch/dist/cjs/index.d.ts:264:12 - error TS2304: Cannot find name 'BodyInit'. 264 body?: BodyInit | Record<any, any>; ~~~~ tsconfig:...
Solution:
Fixed in @sapphire/fetch v3.0.1 ( #Announcements ) @sach!n

'api' does not exist in type 'ClientOptions'.

I'm not able to specify API-related options because I get this: Object literal may only specify known properties, and 'api' does not exist in type 'ClientOptions'....

message and chat input command with arguments

I want to register same command as message command and chatInput command with arguments, is there an example of how to use same reply function for both messageRun and chatInputRun in this case ?
Solution:
you parse arguments and options individually for chat input and message run and then send the parsed values to a shared function

Ratelimits utility wont work as expected

I am not running this code on a Sapphire bot context!
Solution:
NVM! Solved, I removed the limit value on the class
No description

Global precondition error

I checked it may be related to the new update from Piece.Context -> Piece.LoaderContext Any idea how to solve it ?...
Solution:
use AllFlowsPrecondition.LoaderContext instead
No description

Pagination

does sapphire have something for this?

PaginatedMessage: There are no actions

This error is being thrown when your actions is empty tho I have only PageActions. Is Having a BaseAction a must? ```ts private async sendMenu(interactionOrMessage: Message | AnyInteractableInteraction) { const radioStations = radioList; // await Radio.findAll(); const chunkSize = 10; const paginatedMessage = new PaginatedMessageEmbedFields()...
Solution:
@Saitama can you test the Pr with pnpm add @sapphire/discord.js-utilities@pr-684?
No description

PaginatedMessage: How to disable footer?

Hey there! I made a custom paging indicator via components and didn't find anything for disabling the footer on embed. Checked the docs didn't find anything related.
Solution:
v7.1.4 released that can fix this issue with the new setter @skaneprime (see #Announcements )
No description

Code has errors

`js const embed = { title: `Chapter: ${chapter}, Verse: ${verse}`, description: `**Shlok:**\`\`\`${shlok}\`\`\`\n\n**Transliteration:**\`\`\`${transliteration}\`\`\`\n\n**Explanation:** \`\`\`${tej}\`\`\, color: 0x262733,...

API Authentication not working

Hey, its me again. Okay so i followed the sapphire docs and made the authenticated precondition be ```ts...
Solution:
@Oreo ™ Try using the fetch on the event object from the params. It's SvelteKit's special fetch that can include credentials and such. ```ts import type { Handle } from '@sveltejs/kit'; export const handle: Handle = async ({ event, resolve }) => {...

weird bug/error

idk why or how but like

Bit.dev API Plugin not working

Ok, so I'm having a issue with my bot and I'm really struggling to figure out where I've gone wrong. So I started with the template using sapphire new and chose the typescript variation and full template, which has the api's. I then converted this bot template to work with Bit.dev as can be found here: ...

How to config baseUserDirectory

Hello I have a bot and I want to sort my bot module in differents folders : For example : ```js...
Solution:
You don't configure that through setting the baseUserDirectory. Instead you leverage a system such as https://www.sapphirejs.dev/docs/Guide/additional-information/implementing-a-discordpy-like-cog-system or use the plugin by @killbasa https://github.com/KBot-discord/plugins/tree/main/packages/modules#readme

On Listeners

A couple questions on listener pieces: - Where can I find a list of available sapphire event identifiers and their respective arguments? - Does sapphire have any listeners or similar setup by default and if so which ones?...
Solution:
Where can I find a list of available sapphire event identifiers and their respective arguments?
Events enum as well as the https://sapphirejs.dev documentation
Does sapphire have any listeners or similar setup by default and if so which ones?...