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

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

Setting up oauth API

my dashboard is hosted on https://cardinal.oreotm.xyz and my backend is hosted on a vps on [ipaddress] Backend Setup: ```ts...
Solution:
something like http://207.xxx.xxx.xxx:4000 could it be because im mixing http and https while using credentials: 'include'...

Sapphire Snowflake

how is this working if I don't even have @sapphire/snowflake installed? utils.js . ...
Solution:
Even though it's not in your package.json, one of your packages relies on it so it's still downloaded and usable. I forget if it's called a transitive or extraneous dependency

"Couldn't find a template file for that component type."

I'm having trouble setting up a custom component template using Sapphire CLI. Here's the template file (custom-listener.ts.sapphire): ``` { "category": "listeners" }...
Solution:
Solved by moving my custom templates folder to the root directory instead of inside src

Is it possible for a custom command to have a button for a link?

The image shows an example, it's a button on an embed. I know how to put a button onto it, but don't know if it's possible to send them to a link when they press it
Solution:
not really sapphire related but you use .setURL()
No description

Seemingly Random Command Registration Failures

Hello there, I created a basic command, however whenever the bot refreshes, the command registration almost always fails. And this most recent time, the command registered, and then after a refresh, it failed to register again. Error: ``` 2023-12-07 22:42:52 - ERROR - ApplicationCommandRegistries(BulkOverwrite) Failed to overwrite global application commands DiscordAPIError[50035]: Invalid Form Body...
Solution:
Ah issue was from an old issue in an old file that was still in the built files, so was still running

Is that possible to have multiple routes in the same route class?

Something like: ```ts @ApplyOptions<RouteOptions>({ route: 'users' }) export class UsersRoute extends Route { // GET in /users...
Solution:
it is not