blob: 2ec95e05d335f81ecb13e7f3f704a61be2b96631 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
import { BotListener, CommandHandlerEvent, Emitter, type BotCommandHandlerEvents } from '#lib';
export default class CommandCooldownListener extends BotListener {
public constructor() {
super('commandCooldown', {
emitter: Emitter.CommandHandler,
event: CommandHandlerEvent.Cooldown
});
}
public async exec(...[message, command, remaining]: BotCommandHandlerEvents[CommandHandlerEvent.Cooldown]) {
void this.client.console.info(
'commandCooldown',
`<<${message.author.tag}>> tried to run <<${
command ?? message.util!.parsed?.command
}>> but it is on cooldown for <<${Math.round(remaining / 1000)}>> seconds.`
);
message.util!.isSlashMessage(message)
? message.util?.reply({
content: `⏳ This command is on cooldown for ${Math.round(remaining / 1000)} seconds.`,
ephemeral: true
})
: await message.react('⏳').catch(() => null);
}
}
|