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

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

Sapphire preconditions args error

When ever I try to run a precondition, I get this, any ideas on how to fix it?

Custom prefix

How can i implement custom prefix per guild i already have my command which is >prefix <new_prefix> and is saved in mongo but i dont know how can i set it for this server and get the prefix and there is no even of prefix commands here.

Handling argument autocomplete per command

Would it be possible to handle autocompletes through the Command class itself instead and it will be handled accordingly by the interactionCreate event?

Weird error when installing ts-config

image includes the error
Solution:
misspelt my node-linker lol

API error event handler

Hi, when I get a DiscordAPIError through the logger that starts like this:
Encountered error while handling an interaction handler run method for interaction-handler
Encountered error while handling an interaction handler run method for interaction-handler
Is there a singular event to capture these without listening to multiple events such as chatInputCommandError, commandAutocompleteInteractionError and contextMenuCommandError etc?...
Solution:
there isn't but you can easily reuse code. Just import the same function in each listener and pass parameters.