@gcommands/plugin-cooldowns
v1.0.5
Published
Set cooldown for your command
Downloads
2
Maintainers
Readme
GCommands Plugin Cooldowns
Official plugin for GCommands
Installation
Install with npm / yarn / pnpm:
npm install @gcommands/plugin-cooldowns
yarn add @gcommands/plugin-cooldowns
pnpm add @gcommands/plugin-cooldowns
Informations
Yes, GCommands already includes built-in support for cooldowns, but only for short periods like 10 seconds, 1 minute. This plugin is used for cooldown for more than an hour, a day because it is stored in the database.
// index.js / LruCache Provider (recommended)
const { Plugins, GClient } = require('gcommands');
const { MongoDBProvider } = require('gcommands/dist/providers/MongoDBProvider');
const client = new GClient({
database: new MongoDBProvider(process.env.mongodb_uri);
})
Plugins.search(__dirname);
// command.js
const { Command } = require('gcommands');
const { CooldownInhibitor } = require('@gcommands/plugin-cooldowns');
new Command({
inhibitors: [
new CooldownInhibitor({
cooldown: '1d',
message: 'You need wait {duration} before use.'
})
]
...params
})