Fix cooldown display
This commit is contained in:
8
bot.py
8
bot.py
@@ -81,8 +81,8 @@ async def on_message(message: discord.Message):
|
|||||||
if message.author.id == LOEH_ID:
|
if message.author.id == LOEH_ID:
|
||||||
await message.channel.send("https://siphalor.de/img/spidy-is-that-you.jpg")
|
await message.channel.send("https://siphalor.de/img/spidy-is-that-you.jpg")
|
||||||
else:
|
else:
|
||||||
t = time.time() - config_get('och-cooldown', message.guild.id)
|
t = time.time() - _get_last_och_time(message.guild)
|
||||||
if t <= _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!')
|
await message.channel.send('429: Too many requests - Wait ' + str(t) + ' more seconds!')
|
||||||
return
|
return
|
||||||
_set_last_och_time(message.guild)
|
_set_last_och_time(message.guild)
|
||||||
@@ -115,8 +115,8 @@ async def on_message(message: discord.Message):
|
|||||||
return
|
return
|
||||||
elif config_get('och-anyone-enable', message.guild.id) and (
|
elif config_get('och-anyone-enable', message.guild.id) and (
|
||||||
match := OCH_ANYONE_REGEX.search(message.content)) is not None:
|
match := OCH_ANYONE_REGEX.search(message.content)) is not None:
|
||||||
t = time.time() - config_get('och-cooldown', message.guild.id)
|
t = time.time() - _get_last_och_time(message.guild)
|
||||||
if t <= _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!')
|
await message.channel.send('429: Too many requests - Wait ' + str(t) + ' more seconds!')
|
||||||
return
|
return
|
||||||
_set_last_och_time(message.guild)
|
_set_last_och_time(message.guild)
|
||||||
|
|||||||
Reference in New Issue
Block a user