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

messagecommand generated from CLI error

I just started out with Sapphire and i was trying to use the CLI to generate a messagecommand but ran into this error
Unable to resolve signature of class decorator when called as an expression.
The runtime will invoke the decorator with 2 arguments, but the decorator expects 1.
Unable to resolve signature of class decorator when called as an expression.
The runtime will invoke the decorator with 2 arguments, but the decorator expects 1.
...
Solution:
I just started out with Sapphire and i was trying to use the CLI to generate a messagecommand but ran into this error
Unable to resolve signature of class decorator when called as an expression.
The runtime will invoke the decorator with 2 arguments, but the decorator expects 1.
Unable to resolve signature of class decorator when called as an expression.
The runtime will invoke the decorator with 2 arguments, but the decorator expects 1.
...
No description

@sapphire/type installation script error

```cmd $ pnpm i Lockfile is up to date, resolution step is skipped Packages: +327 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...
Solution:
Okay, something odd happened, I ran pnpm add nodemon and it magically installed itself without error? I guess the solution is to install another package instead of running pnpm i

unknown interaction error

Is there a reason why I keep getting random unknown interaction errors? [2023-04-04 00:16:12] [ERROR] Encountered error on chat input command "translate" at path "/workspace/src/commands/basic/translate.js" DiscordAPIError: Unknown interaction [biit] [2023-04-04 00:16:12] at RequestHandler.execute (/workspace/node_modules/discord.js/src/rest/RequestHandler.js:350:13) [biit] [2023-04-04 00:16:12] at processTicksAndRejections (node:internal/process/task_queues:96:5)...
Solution:
Then add interaction.deferReply() before the async function and then reply with interaction.editReply(); Normal commands only can respond in 3 seconds and with deferred 15 minutes...

who to connect html to discord.js?

hi iam trying to connect html form and send data to the bot soo i can do an action with it, how to make it possible?

Messages are not being monitored

I've enabled loadMessageCommandListeners in the ClientOptions, as well as added the MESSAGE partial. The Message Content Intent is also enabled in the Discord apps dashboard, as well as added GUILD_MESSAGES intent in the ClientOptions. However, the bot only responds to commands prefixed with the mention. I've set the default prefix to !.
Solution:
lol, im dumb it should be MESSAGE_CONTENT intent in the options facepalm

Proper pnpm support

I keep getting
The inferred type of 'parse' cannot be named without a reference to '../../node_modules/.pnpm/@sapphire+result@2.6.0/node_modules/@sapphire/result/dist/lib/Option/Some.js'. This is likely not portable. A type annotation is necessary.
The inferred type of 'parse' cannot be named without a reference to '../../node_modules/.pnpm/@sapphire+result@2.6.0/node_modules/@sapphire/result/dist/lib/Option/Some.js'. This is likely not portable. A type annotation is necessary.
in any situation where I use ...

Set the precondition for all commands in a faster way instead of manually set for each command

Is there a faster way to automatically set a specific precondition every time creating new command than use the preconditions option in every command constructor?
Solution:
1. if it's a custom precondition (i.e. one you wrote yourself) set the position option to make it global 2. if it's not a custom precondition (i.e. a built in one) then extend the Command class and use object merging to set it on the custom base class to extend...

Sapphire not getting my commands

Every time i make a command it seems that sapphire doesnt care about them, i put my commands in the commands directory, I am using tsx for my runner (tsx uses esbuild)
Solution:
Every time i make a command it seems that sapphire doesnt care about them, i put my commands in the commands directory, I am using tsx for my runner (tsx uses esbuild)
No description

How to get infos about the current task?

I want to log things like taskid etc. what infos are there to work with and how do I get them inside of my task?

How can i start using bulkOverwrite

I was just curious on how I could start using BulkOverwrite to override slash commands?

Adding preconditions to a slash command?

Is there a way to add a precondition to an application command? I'm not sure if it works the same as the old chat commands or if I would have to hardcode them into each command.

mongoose listener not working

im trying to setup a mongoose listener for the 'open' event however saphire doesnt seem to catch it my best guess is i didnt specify the right emitter as my other listeners work here is a screenshot

TypeError: channel.isTextBased is not a function

I have a problem with Interactions: Since yesterday evening every button interaction results in an error as follows ```js /home/developer/Wishbot/node_modules/discord.js/src/client/actions/InteractionCreate.js:50 if (channel && !channel.isTextBased()) return;...
Solution:
I have a problem with Interactions: Since yesterday evening every button interaction results in an error as follows ```js /home/developer/Wishbot/node_modules/discord.js/src/client/actions/InteractionCreate.js:50 if (channel && !channel.isTextBased()) return;...

Can not resolve dependency sapphire

Hello, after todays NODE JS update, im having an issue with sapphire dependency, would you be able to advise me? thank you.

UserError listener not catching all errors

I am running an imported function in my command, and calling UserError in this file and when I do, it is not caught by the listener, and my bot crashes. Error Source: https://github.com/cosigyn/Clanware-V3/blob/master/src/mods.mjs#L229 Command: https://github.com/cosigyn/Clanware-V3/blob/master/src/commands/general/affiliate.mjs...

API Placeholder in Route

I didn't found it in the docs. Is there any way to get a placeholder into a route like in express with /routename/:id so I can use it to get the resource with the respective id?
Solution:
exactly like that. That isn't Express syntax, that's the recommended REST syntax. you get the params through request.params.id, replace id with whatever you put in :id...

TypeError piace.aliases is not iterable

Good afternoon, I mixed such a strange code as best I could. My task was to add a button to the message with a built-in embed, but it's not clear why I get an error in the console, please give me an answer what I did wrong :). Code and error below. const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, } = require("@discordjs/builders") const { Command, Piece, InteractionHandlerTypes } = require('@sapphire/framework'); const { ButtonStyle, InteractionType } = require("discord.js");...
Solution:
Good afternoon, I mixed such a strange code as best I could. My task was to add a button to the message with a built-in embed, but it's not clear why I get an error in the console, please give me an answer what I did wrong :). Code and error below. const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, } = require("@discordjs/builders") const { Command, Piece, InteractionHandlerTypes } = require('@sapphire/framework'); const { ButtonStyle, InteractionType } = require("discord.js");...
No description

API Client with SSL?

Hey guys, currently I am trying to make the switch from an custom express API to the API plugin. Is there a way to let the plugin consume an ssl cert and open a https server? Greetings...