1.0.5 • Published 2 years ago

@gcommands/plugin-cooldowns v1.0.5

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

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
})
1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago