sapphire-support
discordjs-support
old-sapphire-support
old-discordjs-support
old-application-commands-and-interactions
arguments
how to make arguments throw error when smh is not filled for ex
!prefix set
- but the prefix
is required...Solution:
found it, i was using wrong event. correct event: subcommand error
quick question
is there a way to use sapphire with command cstegories such as
src/commands/misc/...
(just folders to create)Solution:
Other than that you were also given an answer by Kyra in #off-topic - yes
Logger
I am trying to use the logger in shard file, I registered the logger in the /lib/setup file
Solution:
There isn't then
Sharding
Hey! so I was looking at the previous posts about sharding, as it says sharding is completely on D.JS, then what does the
shards: auto
does in the SapphireClient?Solution:
That's part of ClientOptions in discord.js, not sapphire related.
https://old.discordjs.dev/#/docs/discord.js/main/typedef/ClientOptions?scrollTo=shardCount
If set to "auto", it will spawn the recommended amount of shards from discord.js...
Modal listeners
Hello, I have listeners for contextMenu and for chatInput but which one is for a modal of what do I need to do to get one for modals? I would like to use a listener for modal error handling.
Solution:
Can't use Sapphire CLI
I installed sapphire globally using yarn but for some reason it's not working
Solution:
add your
yarn global bin
to your PATHpollSync error
I just started the bot and I get this error by default
```
C:\Users\Charl\OneDrive\Escritorio\Rox\node_modules@sapphire\utilities\dist\lib\pollSync.js:10
AbortSignal.abort().reason.constructor...
Production mode?
I'm having issues disabling the
DEVELOPMENT MODE
.
.env
doesn't allow setting NODE_ENV
and it doesn't work based on the name of the .env
file. I've also tried using MODE
per a Stack Overflow thread I found but that didn't work either. Is there not a solution where I just copy the built files over and change a setting somewhere?...Running commands manually
Is there a way to run commands manually, without a message/interaction making Sapphire do it?
Solution:
Example
``ts
// or, if in a command class, just use
this.store`
const commands = container.stores.get('commands');...Regarding containers
Hello! With regards to the example repos with setup.ts, is every property in the container already available like the Client at startup?
Solution:
Which one exactly are you talking about? There are 3 examples that have a setup.ts and each has some unique content, and none use container. At any rate, the idea of
setup.ts
is that it is called before you can new SapphireClient
, which happens automatically through line 1 at https://github.com/sapphiredev/examples/blob/main/examples/with-typescript-starter/src/index.ts, by calling just import './lib/setup.ts'
instead of something like import { x } from './lib/setup.ts'
that file i...Custom Client Event
How to make it right when I want to custom event for client for example:
client.emit('someEvent', data)
then can I use framework listeners for that events ? like create someEvent.ts file so that I can use or I need to do client.on('someEvent', handler)
for it ?...Solution:
You don't need to do anything. Just make a listener with the file name and/event name prop set to the custom name. In case of the latter you just have to use module augmentation to ensure it gets detected because the event prop is
keyof Client
guildMemberUpdate event
I'm trying to create a listener for the guildMemberUpdate event, and sapphire registers this listener, but the run is never executed
Code:
```import { Listener } from '@sapphire/framework';
import type {GuildMember} from "discord.js";...
Solution:
remove
once: true
, otherwise it gets de-registered after a single call.
Also make sure you have the proper intent in your client options...Creating a custom UserError
I want to use a custom UserError to create preconditions for my subcommands. I can't find any documentation examples on it.
Anyone have any suggestions so that in my custom preconditions class I can call
throw new UserError
and have it go to my custom function?...Sharding via DJS and Sapphire
Hey y'all, I'm looking at the Discord.JS docs for sharding and wanting to implement that within Sapphire.
From my search in this server I found to use the DJS method of using it as Sapphire doesn't support extra with that.
However, there isn't a ShardManager included in Sapphire, and I still want to use the Sapphire Client options. Is that still possible with Sapphire or do I have to eliminate the SapphireClient completely (which defeats the purpose?)...
Solution:
Sapphire doesn't ship its own sharder because it works with Discordjs's, you just instantiate
SapphireClient
instead of Client
.Hide the page selector with paginated messages?
I'd love some help hiding this selector in my paginated message, I've looked through the docs but I'm unable to see a solution, thanks!
https://ss.clanware.org/sg21mE.png...
Solution:
https://www.sapphirejs.dev/docs/Documentation/api-utilities/classes/sapphire_discord_js_utilities.PaginatedMessage#setactions & https://www.sapphirejs.dev/docs/Documentation/api-utilities/classes/sapphire_discord_js_utilities.PaginatedMessage#defaultactions
Or set the default actions globally because it's a static...
Subcommand issues
I'm having an issue with subcommands where it just doesn't seem to recognize a subcommand.
The following is how I register the command I'm having issues with.
All of them work fine except guild whitelist. That one throws this error: https://hyperfire-dev.sentry.io/share/issue/1464c7085b934a0296005c7e7ee22553/
...
Trouble with telling typescript the return type of fetch when using @sapphire/result
Hi there,
I have a function that fetches an API using the native
fetch
function. The fetch
is wrapped in Result.fromAsync()
, and I wanted to do Result.fromAsync<Promise<APIResponse>>
since I know what the API will return. The problem is, when doing Result.fromAsync<Promise<APIResponse>>
Typescript says that Response
is missing certain properties that I know the API will return.
How would I tell Typescript I know that the fetch will return this?...i18n question
So this works
but when I use
applyLocalizedBuilder(builder, 'commands/names', 'commands/descriptions:name')
applyLocalizedBuilder(builder, 'commands/names', 'commands/descriptions:name')
applyLocalizedBuilder(builder, 'commands:ping')
...