New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

command-cooldown

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

command-cooldown

a simple (discord bots anything really) cooldown for commands made using quick.db

latest
npmnpm
Version
1.0.0
Version published
Weekly downloads
3
50%
Maintainers
1
Weekly downloads
 
Created
Source

command-cooldown

a simple (discord bots anything really) cooldown for commands made using quick.db

V 1.0.0 is Here with new changes

  • do i need to tell you ? (fixed some issues again again again).
  • fixed some issues again lol.
  • added spam protection if you want lol, ".res.spam".
  • added multi cooldowns for every command option.
  • Fixed some issues with the database.

Features

  • Easy to use.
  • Fast.
  • You can change everything.

Requirements

  • quick.db , for saving cooldowns in order to avoid cooldowns being removed before it's timer runs out.

Changelog

See Changelog !

Supports :

  • node.js

Configuration

  • example with discord.js
  • this example allows you to make a cooldown for each command individually if you do not want this do "cmdCD.addCoolDown(message.author.id, 5000);" and "await cmdCD.checkCoolDown(message.author.id)"
const cmdCD = require('command-cooldown');

client.on('message',async message => {
    if (message.content == "ping") {
       let cd = await cmdCD.checkCoolDown(message.author.id, "cmd-ping");
        if (cd.res.spam) return "this user spams this command, i will not do any thing in order to not get rate limted";
        if (!cd.res.ready) return message.reply(`Reamaining ${(cd.res.rem / 1000).toFixed(1)}s`);

        message.reply(`My Ping is : ( ${client.ws.ping}Ms )`);
        cmdCD.addCoolDown(message.author.id, 5000, "cmd-ping");
    };
});

Response

it will output remaning time in ms so you could do anything :)

{
    ready : Boolean // whether the command is ready to user or not
    rem : Timestapms //remaining time
    cmd : String // cooldown's command name
    spam : Boolean // if the user is spamming the cooldown
}

Options

These are the keys in the options you can pass.

  • ID, type : string or number, the cooldown author id
  • 5000 , type : Timestamp, the cooldown duration in ms.
  • "cmd-name" , type : String, the cooldown command name this helps to add multi cooldowns *NOT REQUIERD*.
cmdCD.addCoolDown(ID, 5000, "cmd-name");
                  ^^  ^^^^
* ^ = required

Keywords

cooldown

FAQs

Package last updated on 23 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts