Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Discord.py already provides this, you can add a decorator:
@commands.cooldown(1, (Время задержки), commands.BucketType.user)
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandOnCooldown):
embed = discord.Embed(
title = 'Команда на задержке.',
description = f'Повторить через `{error.retry_after :.0f} секунд',
colour = discord.Color.red()
)
return await ctx.send(embed = embed)
After applying the command, save the timestamp in the database. Further, when reapplying, calculate the timestamp of the moment when the minimum command should have been used the first time. If this time is more than what is in the database, execute the command. Otherwise, display a message.
You are free to come up with the implementation yourself. But you definitely need somewhere to save the user id, command id (if there are several commands) and the timestamp of the last use. Base, file or memory - you choose.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question