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
discord-cooldown-0.1.1.tar.gz
(7.5 kB
view hashes)
Built Distribution
Close
Hashes for discord_cooldown-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18dd9e09491e23d7fe944b17308e52fd187dc1d78220a7a65c95796942d1bbab |
|
MD5 | 72a65b31dc78c1ada0a653803fc75a64 |
|
BLAKE2b-256 | 00cc53982a19c6777ba46b0c90fffd132186198bad5bb4cf22d66773b705746e |