From 510d977cab0c6f377542db56594d49aaec3e8fb6 Mon Sep 17 00:00:00 2001 From: Siphalor Date: Wed, 27 Jan 2021 15:40:23 +0100 Subject: [PATCH] Fix cooldown display again --- bot.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bot.py b/bot.py index 2364f81..0d08d3e 100644 --- a/bot.py +++ b/bot.py @@ -81,9 +81,10 @@ async def on_message(message: discord.Message): if message.author.id == LOEH_ID: await message.channel.send("https://siphalor.de/img/spidy-is-that-you.jpg") else: + cooldown = config_get('och-cooldown', message.guild.id) t = time.time() - _get_last_och_time(message.guild) - if t <= config_get('och-cooldown', message.guild.id): - await message.channel.send('429: Too many requests - Wait ' + str(t) + ' more seconds!') + if t <= cooldown: + await message.channel.send('429: Too many requests - Wait ' + str(int(cooldown - t)) + ' more seconds!') return _set_last_och_time(message.guild) @@ -115,9 +116,10 @@ async def on_message(message: discord.Message): return elif config_get('och-anyone-enable', message.guild.id) and ( match := OCH_ANYONE_REGEX.search(message.content)) is not None: + cooldown = config_get('och-cooldown', message.guild.id) t = time.time() - _get_last_och_time(message.guild) - if t <= config_get('och-cooldown', message.guild.id): - await message.channel.send('429: Too many requests - Wait ' + str(t) + ' more seconds!') + if t <= cooldown: + await message.channel.send('429: Too many requests - Wait ' + str(int(cooldown - t)) + ' more seconds!') return _set_last_och_time(message.guild)