From 5610fc7acdb4d01b7cfc16cae4fd53f6d6b8a9ca Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Thu, 13 Feb 2025 16:29:08 -0500 Subject: [PATCH] refactor: minor cleanups --- core.py | 7 ++++--- utils/discord.py | 3 +-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core.py b/core.py index d9b67c1..e335bf7 100644 --- a/core.py +++ b/core.py @@ -48,11 +48,12 @@ async def on_message(message, edited=False): try: if (cooldowns := command_cooldowns.get(message.author.id)) and not edited: - cur_time = time.time() - if (end_time := cooldowns.get(matched)) and round(end_time - cur_time) > 0: + if (end_time := cooldowns.get(matched)) and ( + remaining_time := round(end_time - time.time()) > 0 + ): await utils.reply( message, - f"please wait **{utils.format_duration(round(end_time - cur_time), natural=True)}** before using this command again!", + f"please wait **{utils.format_duration(remaining_time, natural=True)}** before using this command again!", ) return diff --git a/utils/discord.py b/utils/discord.py index 6913743..ad26fca 100644 --- a/utils/discord.py +++ b/utils/discord.py @@ -90,8 +90,7 @@ class ChannelResponseWrapper: self.sent_message = None async def send_message(self, **kwargs): - if "ephemeral" in kwargs: - del kwargs["ephemeral"] + kwargs.pop("ephemeral", None) self.sent_message = await reply(self.message, **kwargs) async def edit_message(self, content=None, embed=None, view=None):