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

Getting the client to log a list of registered commands and if they are global

I was just wondering if there was a way, once the ApplicationCommandRegistry finished initialising, I could get the registered command data?
Solution:
client.application.commands, discordjs code

PaginatedMessage autodelete

Heyyy, Is there a way to auto delete PaginatedMessage after it has been closed ?...
Solution:
extend the class and overwrite the handleEnd method

Message Components Disappearing?

I have the weirdest issue. I'm using pagination from @sapphire/discord.js-utilities, but sometimes message components don't show up (although you can see "1/2" in the footer, and there are definitely supposed to be 2 pages). Example in the first image. But then I found some matrix shit, because I took the second image as a screenshot (with message components) 5 hours ago. I check the message now, and the components disappeared, without leaving a (edited) label behind (see third image). ???...

Modal Submit Preconditions

how could i use preconditions on interactions of type modalsubmit?
Solution:
Use an if statement in your parse method

BOT don't catch commands

my bot don't catch commands, what i try to mean is that when i use for example: -ping command it doesn't say anything, i don't know what i'm doing BAD 'cause i'm watching a video, can someone help me? please <:clown_sob:765318460241870920> index.js ```js const { SapphireClient } = require("@sapphire/framework");...

TypeError Cannot read properties of undefined (reading 'CHANNEL_CREATE')

I don't think the problem with sapphire bbut if you can help me ?

Does sapphire work only with DJS?

Would sapphire be compatible with something like Eris?
Solution:
Sapphire is a DiscordJS framework yes. We would also recommend against using Eris in 20223 because it's pretty much a dead library...

String Length error while trying to register a command

command registry for command "setup" at path "/home/userland/dev/shnhelper/dist/commands/Configuration/setup.js" ExpectedConstraintError > s.string.lengthGreaterThanOrEqual 2022-12-31 12:34:33 - ERROR - Invalid string length 2022-12-31 12:34:33 - ERROR - 2022-12-31 12:34:33 - ERROR - Expected: expected.length >= 1 2022-12-31 12:34:33 - ERROR -...
Solution:
I found the error; Basically when I called the "super" function inside the constructor, it overwrote all the configuration provided by the decorator

How to make translated message in interaction handler?

I`m new with sapphire framework btw, and i'm also hoping to use english fluently lol

The argument did not resolve to emoji

Hi, I am using sapphire v3.1.4 currently. I have created a message command where users need to provide 2 or more emojis, so I utilize the built-in emoji argument of sapphire, however when I test the command and pass twemojis, it raises the error I posted in title (see 2nd screenshot). I am a bit confused why it happens. If anyone can guide me in right direction, it would be immensely appreciated. Thank you for reading. ablobcatheartsqueeze

Where can I find more info about the Sapphire framework

I wanna know more about it, since this is my first time hearing about the Sapphire framework

Encountered error on event listener CoreMessageParser f

Encountered error on event listener "CoreMessageParser" for event "preMessageParsed" at path "F:\JuyeonJS_chatMod\node_modules\@sapphire\framework\dist\listeners\command-handler\CoreMessageParser.js" Type
Error: me.isCommunicationDisabled is not a function
at CoreListener.canRunInChannel (F:\JuyeonJS_chatMod\node_modules\@sapphire\framework\dist\listeners\command-handler\CoreMessageParser.js:49:16)
Encountered error on event listener "CoreMessageParser" for event "preMessageParsed" at path "F:\JuyeonJS_chatMod\node_modules\@sapphire\framework\dist\listeners\command-handler\CoreMessageParser.js" Type
Error: me.isCommunicationDisabled is not a function
at CoreListener.canRunInChannel (F:\JuyeonJS_chatMod\node_modules\@sapphire\framework\dist\listeners\command-handler\CoreMessageParser.js:49:16)
...
Solution:
anyway you should still migrate to v3.

Command Error

There seems to be a problem with sapphire not running my ChatInputCommandError listener. I tried debugging console.log({ error, context }) inside the run method but it doesn't log. :check: My pieces directory is in the right place :check: The listener is not configured to run only once...
Solution:
Subcommands have their own enum and own events

Use commands from src and also from custom package in node_modules (Programatically add commands?)

There's probably a better way to do this, but wrapping my head around how I want to approach it. I'm working on a variety of smaller NPM packages that I intend to use across a bunch of different bots/projects. One of these packages, I want to have a debug command - without having to specify what that command is/does inside of each project - I only want to specify it once at the package level, as all projects will use it the same. ...
Solution:
Sapphire has the ability to load plugins from npm packages, meaning that you can load those stores into your bot. https://github.com/sapphiredev/plugins has examples

Error [UNLOADED_PIECE] The piece 'CoreReady' does not exist.

I have no idea why prod started throwing this error on restart, cannot reproduce on test ```32|Massive-Automation | Error [UNLOADED_PIECE]: The piece 'CoreReady' does not exist. 32|Massive-Automation | at Map.resolve (/root/Massive/Automation/node_modules/@sapphire/pieces/dist/lib/structures/Store.js:152:23) 32|Massive-Automation | at Map.unload (/root/Massive/Automation/node_modules/@sapphire/pieces/dist/lib/structures/Store.js:98:28)...
Solution:
I moved my client.login to a different file and forgot to re-upload the file I removed the old call from, so it was getting called twice. Sorry to bother

Commands not working

I created a command and it won't work.
Solution:
We didn't write the guide for it to be blatantly ignored

Can't register application command.

I have followed docs here to create ping command but when using slash there no my app ping command. Do I need to something else to register command https://www.sapphirejs.dev/docs/Guide/getting-started/creating-a-basic-app-command...

Custom Arg - ResultError Unwrap failed

This seemed to be working for me in a previous version of Sapphire - but I've only recently gotten back into the swing of things, so there's a good chance I've missed a change. I have a prefix command that has a single arg. The custom arg works great, for returning a result where a result actually does exist (items from item system) Where that item doesn't exist, it throws an error with the identifier "InputNotanItem"....
Solution:
After PR 601 (https://github.com/sapphiredev/framework/pull/601) is merged and released then the err.value is no longer needed.

about args

can help me about this?
Solution:

How do I apply preconditions to a specific subcommand

I’d like to only apply my OwnerOnly precondition to certain sub commands instead of all of them. Is there a way to do this?
Solution:
It is not supported and unless someone makes a PR to the plugin it likely won't be. What you can do is extract the code of the ownerOnly check to a function then import that in both places because ultimately preconditions are just glorified if checks