Skip to main content

Package Name: discord_cooldown

A responsive package for Bot command cooldowns

• With this package you can create the command cooldowns which will not get reset whenever the bot re-run

forthebadge made-with-python

CodeQL Python Github License Windows Linux

GitHub stars GitHub forks GitHub issues

Join Official Discord Server for more guidance !


Features

  • Cooldowns of Bot commands are stored in a DATABASE
  • Available Databases MySQL, PostgreSQL and Sqlite(Sqlite3)

Installation

Python 3.8 or higher is required !

# Linux/macOS
  python3 -m pip install discord-cooldown

# Windows
  # Method-1:
    py -3 -m pip install discord-cooldown
    # or
    python -m pip install discord-cooldown
  # Method-2:
    pip install discord-cooldown

# Using GIT for ALPHA or BETA Versions
  # Method-1:
    pip install git+https://github.com/Modern-Realm/discord_cooldown
  # Method-2:
    pip install -U git+https://github.com/Modern-Realm/discord_cooldown

Note: For better stability install package from GitHub using GIT


REQUIRED DEPENDENCIES

You can use ANY ONE of the below discord API Package

Note: Don't install more than one DEPENDENCY !

Other Dependencies


QuickStart

from discord_cooldown.modules import MySQL
from discord_cooldown import Cooldown

import discord

from discord.ext import commands
from datetime import timedelta

TOKEN = ""
intents = discord.Intents.all()
client = commands.Bot(command_prefix="&", intents=intents)

# MySQL Database Setup
db = MySQL(
    host="", db_name="",
    user="", passwd=""
)

# For Indian timezone (UTC +5:30)
timezone = +timedelta(hours=5, minutes=30)


def CD():
    return Cooldown(database=db, timezone=timezone)


@client.event
async def on_ready():
    await client.change_presence(status=discord.Status.online, activity=discord.Game("&help"))
    print("Bot is online")


@client.event
async def on_command_error(ctx, error):
    if isinstance(error, commands.CommandOnCooldown):
        return await ctx.send(
            f"on cooldown retry after `{timedelta(seconds=error.retry_after)}`"
        )
    else:
        # For resetting a command on any error other than CommandOnCooldown
        return await CD().reset_cooldown(ctx.author, ctx.command.name)


@CD().cooldown(1, 2 * 60)
@client.command()
async def test(ctx):
    await ctx.send("testing")


@CD().cooldown(2, 0, reset_per_day=True)
@client.command()
async def vote(ctx):
    await ctx.send("done")


@CD().cooldown(3, 60)
@client.command()
async def test1(ctx, *, msg: str):
    await ctx.send("message is " + msg)


if __name__ == "__main__":
    client.run(TOKEN)

Project Links

You can get support/help/guidance from below social-media links

Metadata

Release files for discord-cooldown 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for discord-cooldown 0.1.4
File Size Uploaded Provenance
discord-cooldown-0.1.4.tar.gz 9.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for discord-cooldown 0.1.4
File Interpreter ABI Platform
discord_cooldown-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 17.8 kB

Release files / discord-cooldown-0.1.4.tar.gz

Download URL discord-cooldown-0.1.4.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ec749fcd20583f59ce3581c1c9634aa8d9c2b56adf1ff5d226ed475e310c1948
BLAKE2b-256 checksum
How to use checksums
58bd906015191432ae2ca4ff65d6e951bc7af211f85aa6c47c87184e10c5410d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.0

Release files / discord_cooldown-0.1.4-py3-none-any.whl

Download URL discord_cooldown-0.1.4-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b6800e48d38d7f17e3bb1d72dafc13f3e898b911d8504d8fcc08e73ac191832f
BLAKE2b-256 checksum
How to use checksums
82fef6681270147b1f56631ceedbe3323cd36023501782e9866df6a3a8562639
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.0

Security for discord-cooldown 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page