From b3a299ae1b62a4210f2a0f3c9f5d8b425be4efc4 Mon Sep 17 00:00:00 2001 From: snipe <72265661+notsniped@users.noreply.github.com> Date: Thu, 5 Jan 2023 16:53:13 +0530 Subject: [PATCH] Patch cooldown handler to support Pycord slash commands --- main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 6490dbd1..a55607db 100644 --- a/main.py +++ b/main.py @@ -182,8 +182,8 @@ async def on_message(ctx): #Error handler @client.event -async def on_command_error(ctx, error): - current_time = floor(time.time()).strftime("%H:%M:%S") +async def on_application_command_error(ctx: ApplicationContext, error: discord.DiscordException): + current_time = datetime.time().strftime("%H:%M:%S") if isinstance(error, commands.CommandOnCooldown): await ctx.channel.send(f':stopwatch: Not now! Please try after **{str(datetime.timedelta(seconds=int(round(error.retry_after))))}**') print(f'[{current_time}] Ignoring exception at {colors.cyan}CommandOnCooldown{colors.end}. Details: This command is currently on cooldown.')