Custom CooldownsDB for discord Bot commands
Project description
Package Name: discord_cooldown
A responsive package for command cooldowns
• With this package you can create the command cooldowns which will not get reset whenever the bot re-run
Join Official Discord Server for more guidance !
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.git
# Method-2:
pip install -U git+https://github.com/Modern-Realm/discord_cooldown
REQUIRED DEPENDENCIES
You can use ANY ONE of the below Package
-
py-cord
-
nextcord
-
discord.pyV2.0
-
disnake
For disnake you should Refactor/ Shim all discord terms to disnake terms to make Package work
Note: Don't install more than one DEPENDENCY !
QuickStart
from discord_cooldown.cooldown import Cooldown
import discord
from discord.ext import commands
intents = discord.Intents.all()
client = commands.Bot(command_prefix="&", intents=intents)
@client.event
async def on_ready():
print("Bot's online !")
@client.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandOnCooldown):
em = discord.Embed(description=f"This command is on cooldown\n"
f"Retry after {error.retry_after}")
return await ctx.reply(embed=em, mention_author=False)
@Cooldown().cooldown(1, 2 * 60)
@client.command()
async def test(ctx):
"""
Returns an error: commands.CommandOnCooldown if it's on cooldown
"""
await ctx.send("Hello world !")
@Cooldown().cooldown(1, 0, commands.BucketType.guild, reset_per_day=True)
@client.command(aliases=['sf'])
async def serverinfo(ctx):
guild = ctx.guild
em = discord.Embed(
title="Server Info",
description=f"Server Name: {guild.name}\n"
f"Total Members: {guild.member_count}\n"
f"Owner: {guild.owner.mention}"
)
await ctx.reply(embed=em, mention_author=False)
client.run(TOKEN)
Project Links
You can get support/help/guidance from below social-media links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file discord-cooldown-0.1.1.tar.gz
.
File metadata
- Download URL: discord-cooldown-0.1.1.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62188ffbcd0a7b115c9082a354dba15984da2f739b5a49d37e6498081e7d4ba7 |
|
MD5 | 139a0ec13c9c6e10af0714d92d383677 |
|
BLAKE2b-256 | ee7937fab8112a544bfdf63362d696102576e6a25244b5092fffaf735808afe6 |
Provenance
File details
Details for the file discord_cooldown-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: discord_cooldown-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18dd9e09491e23d7fe944b17308e52fd187dc1d78220a7a65c95796942d1bbab |
|
MD5 | 72a65b31dc78c1ada0a653803fc75a64 |
|
BLAKE2b-256 | 00cc53982a19c6777ba46b0c90fffd132186198bad5bb4cf22d66773b705746e |