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

messageRun commands

I'm getting an issue and honestly, don't know what's wrong, i'm using the template generated by the CLI and everything runs fine, however, when i try preconditions on messageRun subcommands they just not work for some reason? they work on messageRun commands but not subcommands. For example, i'm trying the precondition that comes with the template ```ts export class OwnerOnlyPrecondition extends AllFlowsPrecondition {...
Solution:
If I use sapphire new and then make only 2 edits: 1. Fill in .env 2. Add preconditions: ['OwnerOnly'] to src/commands/General/command-with-subcommands.ts then it does work...

i18n only translate command description

```ts public override async registerApplicationCommands(registry: ApplicationCommandRegistry) { registry.registerChatInputCommand((builder) => applyLocalizedBuilder(builder, 'commands/mycommand:name', 'commands/mycommand:description').setDMPermission(true) );...
Solution:
the latter, or set the same name in each of your language files

How does ApplyOptions work

I have been looking through the examples that are on the sapphire github and they have this bit and everytime i use the applyoptions thing, it just doesnt work. I referred to chatGPT and it said that applyoptions only really works for methods and im really confused
Solution:
Check your TypeScript configuration (tsconfig.json) to ensure decorators are enabled. Ensure that the experimentalDecorators option is set to true.
No description

Autofill message textbox

Is it possible to autofill the message text box upon the press of a button. The idea is to have a button which when pressed auto fills the text box with the intial part of the command (this command also has some options which the user needs to set)

Autocomplete TextInput

Is it possible to suggest something for the text input? https://discord.js.org/docs/packages/discord.js/14.15.2/TextInputBuilder:Class...
Solution:
There is autocomplete for command options but that's it. It doesn't exist for text input components.

BulkOverwrite has stopped functioning

In the last 5 months have there been any breaking changes to how commands register? I created 2 sapphirecli slash commands and one has appeared after several days (roll), the other one (createchannel) was pushed 2 hours ago and has not shown up in the BulkOverwritten guild yet.
Solution:
I think I might be deleting/creating my container incorrectly, is this not enough to update a running container?
No description

Custom logging messages

How can i create custom logs? I want to change the colors and text used in logs along with icons, where and how could i make that change?...

logging registered commands

how can I, at runtime, send all bot commands to the console for example?
Solution:
you could use colorette yourself but you cant edit the [INFO] [DEBUG] etc of the plugin logger

Registering Commands Issue

Hey there, I've recently started using sapphire, and I've used it before without running into this issue, but when I run my project (using bun, I've tried npm as well, same issue.) I continuously get the error
error: A compatible class export was not found. [C:\Users\iratm\OneDrive\Desktop\Unnamed\src\commands\util\test.ts]
error: A compatible class export was not found. [C:\Users\iratm\OneDrive\Desktop\Unnamed\src\commands\util\test.ts]
and I'm not sure what the issue is because I've followed the docs exactly besides changing the name of the class...

Scheduled Tasks not working

Hi, I've been trying to add the scheduled-tasks plugin but it doesn't seem to work, i honestly don't know what I'm doing wrong. ```ts import { ScheduledTask } from '@sapphire/plugin-scheduled-tasks'; ...
Solution:
also you're missing /register here

Help with slash commands

Hello, I'm trying to work on a project that involves doing some type of user lookup in a database. My current code looks like this: ```typescript public override registerApplicationCommands(registry: Command.Registry) { registry.registerChatInputCommand((builder) =>...
Solution:
instead of adding a string option, add a user option. You can see this in action with many of @Spinel 's commands for the target option

API References

Is there a webpage containing all API References for the framework. For example InteractionHandler, all its functions, their purpose, return values, what arguments they take in etc... So a detailed technical page. I can see sapphire/shapeshift and some other stuff have it, but not framework. Which is the main one.

Custom logger transport

Hello is they a way to set custom logger transport (like what winston allow to do) with sapphire logger (plugin logger) ? I saw other ppls also want similar things/support with winston...

How do i enable DM message detection?

I have 'messageCreate' listener on bot, but it does not seem to detect the messages received by the bot in dm.
Solution:
Assuming you followed the instructions from the second big red block on the guide: https://sapphirejs.dev/docs/Guide/getting-started/getting-started-with-sapphire You have to also enable the Channels partial https://discordjs.guide/popular-topics/partials.html#handling-partial-data...

Multiple Command Folders?

I want to make 2 different bots on 2 separate project folders in the same hard drive. My second bot keeps getting errors from Sapphire reading the command folder on my first bot. I don't use any fixed path; I only use relative paths. How do I make Sapphire look into the correct command folder?
Solution:
So I switched the "REQUIRES OAUTH2 CODE GRANT" off and it works now! :yay:

node-gyp build problems with @sapphire/type

Trying to install @sapphire/type, bufferutil or other native libraries fails on my windows machine. Visual studio throws syntax errors parsing the node includes. The problem does not occur with clang on my linux machine. As vs22 is the recommend version for node-gyp 10.1.0, I'm puzzled what the error might be, however I have no direct experience with node modules in this sense....

Error importing a plugin

here is my index.js - https://pastebin.com/3HDUAfVY Here is the plugin I'm trying to import and having an issue with - https://pastebin.com/45Nm9hSf I am not great with javascript, maybe I'm missing something? can someone point me in the right places?...
Solution:
you placed it inside of "src/commands", which the command store expects everything inside of there to extend the "Command" class, causing that error to occur as for how plugins are done: you can refer to here https://github.com/sapphiredev/plugins/tree/main/packages im unsure if there's a guide on making them or not...

Question to Plugin i18next

I would like to start using @sapphire/plugin-i18next. Can i fetch language files from a another repository (or from my own npm module)?...
Solution:
Both yes if you set the path accordingly.