From ea09f291e521b9740e0b4c64c528920274e4c362 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 10 Feb 2025 18:07:29 -0500 Subject: [PATCH] refactor(core): tweak cooldown calculation Should prevent issues where cooldown is 0 when formatted. --- core.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core.py b/core.py index 0a8bbe3..d9b67c1 100644 --- a/core.py +++ b/core.py @@ -48,12 +48,11 @@ async def on_message(message, edited=False): try: if (cooldowns := command_cooldowns.get(message.author.id)) and not edited: - if (end_time := cooldowns.get(matched)) and int(time.time()) < int( - end_time - ): + cur_time = time.time() + if (end_time := cooldowns.get(matched)) and round(end_time - cur_time) > 0: await utils.reply( message, - f"please wait **{utils.format_duration(int(end_time - time.time()), natural=True)}** before using this command again!", + f"please wait **{utils.format_duration(round(end_time - cur_time), natural=True)}** before using this command again!", ) return