incorporate a cooldown on the chat command? #188
Unanswered
kamborghini
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have been trying to incorporate a cooldown into the chat command so that I can implement this into my free discord server about learning how to prompt.
This is the .py I have been trying to use. any help would be appreciated.
from discord.ext import commands
bot = commands.Bot(command_prefix='/')
@bot.command(name='chat')
@commands.cooldown(1, 900, commands.BucketType.user)
async def chat_command(ctx):
# Your code here
await ctx.send('Hello!')
@chat_command.error
async def chat_command_error(ctx, error):
if isinstance(error, commands.CommandOnCooldown):
await ctx.send(f'This command is on cooldown. Please wait {error.retry_after:.2f} seconds.')
else:
raise error
Beta Was this translation helpful? Give feedback.
All reactions