Cyber Grandma
Explore posts from serversSIASapphire - Imagine a framework
•Created by Cyber Grandma on 11/9/2023 in #sapphire-support
Multiple listeners on the same event ?
Hi, I'm trying to define two listeners for the same event (
chatInputCommandError
)
My folder is organised as such:
src >
listeners >
commands >
chatInputCommandError.ts
chatInputCommandErrorBis.ts
I want to handle some different types of errors in these two files.
In these two files it's basically like so:
The issue is that the second file is never fired on errors, only the first one.
What did I miss in the docs to make that work ?
Thanks ❤️4 replies
SIASapphire - Imagine a framework
•Created by Cyber Grandma on 9/23/2023 in #sapphire-support
Type safe Slash Commands Options ?
Hi there, I can't seem to find a way to add Type Safe options to a Slash command. See Example:
I have a Type called
type Difficulty = 'easy' | 'medium' | 'hard'
and functions that expect this type. But the interaction.options.getString('difficulty', false)
method simply returns string
. Which means I need to add as Difficulty
to it. And I feel like it defeats a little bit the purpose of TypeScript when I do this.
So I was wondering if there was a better way to handle this, or should I just rely on Runtime checking ?
Thanks ❤️2 replies