Cooldown
Erine provides you a built-in plugin to cooldown your commands with ease.
Buckets
<Bucket>.Channel
: Represents a GuildChannel.<Bucket>.Member
: Represents a GuildMember.<Bucket>.Guild
: Represents a Guild.<Bucket>.User
: Represents a Discord User.
Example
const { Bucket, CommandBuilder, Plugins } = require('erine');
const data = {
data: new CommandBuilder({
name: "say",
as_slash: true,
as_prefix: true
}),
plugins: [Plugins.cooldown(5000, Bucket.User)],
async code(context) {
await context.send('Hello from Erine!');
}
}
module.exports = { data }
You must handle cooldown errors with <Errors>.CommandInCooldown
.