Cooldown

When I set a command cooldown it doesn't seem to send a error message?
10 Replies
Favna
Favna15mo ago
Sapphire Framework
Reporting precondition failure | Sapphire
When a precondition fails, it's usually important for the user to know why. For example, if they hit a cooldown or lack
Slime
SlimeOP15mo ago
I checked that but wasn't sure if it's command denied Nothing gets printed when trying to log I can post code when home
Favna
Favna15mo ago
please do
Slime
SlimeOP15mo ago
export class ChatInputCommandDenied extends Listener<typeof Events.ChatInputCommandDenied> {
public run(error: UserError, { interaction }: ChatInputCommandDeniedPayload) {
console.log(error)
console.log(interaction)
// ...
}
}
export class ChatInputCommandDenied extends Listener<typeof Events.ChatInputCommandDenied> {
public run(error: UserError, { interaction }: ChatInputCommandDeniedPayload) {
console.log(error)
console.log(interaction)
// ...
}
}
and I am using a slash command with
public constructor(context: Command.Context) {
super(context, {
cooldownDelay: Time.Second * 5,
cooldownScope: BucketScope.User
});
}
public constructor(context: Command.Context) {
super(context, {
cooldownDelay: Time.Second * 5,
cooldownScope: BucketScope.User
});
}
Favna
Favna15mo ago
name of the listener file? and did you rebuild ts?
Slime
SlimeOP15mo ago
Cooldown.ts yeah I did I can try clear it
Lioness100
Lioness10015mo ago
It should be chatInputCommandDenied.ts Or you can add { event: Events.ChatInputCommandDenied } to the constructor
Slime
SlimeOP15mo ago
ahh I see, I missed that completely :S do you have an example for the constructor what I need inside it? It's printing now so I can debug it and figure out the rest thank you so much both of you two
Favna
Favna15mo ago
Sapphire Framework
Creating your own listeners | Sapphire
Similar to what you learned in both Creating Commands and [Creating
Slime
SlimeOP15mo ago
oh I see So to sum it up listeners needs the actual name of the listener exactly otherwise overriden in constructor, while preconditions can have any name Either way I will read the guide more as it's very well-written and I missed a few things on it so thanks again!
Want results from more Discord servers?
Add your server