refactor: minor cleanups
This commit is contained in:
parent
c73260badb
commit
5610fc7acd
7
core.py
7
core.py
@ -48,11 +48,12 @@ async def on_message(message, edited=False):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
if (cooldowns := command_cooldowns.get(message.author.id)) and not edited:
|
if (cooldowns := command_cooldowns.get(message.author.id)) and not edited:
|
||||||
cur_time = time.time()
|
if (end_time := cooldowns.get(matched)) and (
|
||||||
if (end_time := cooldowns.get(matched)) and round(end_time - cur_time) > 0:
|
remaining_time := round(end_time - time.time()) > 0
|
||||||
|
):
|
||||||
await utils.reply(
|
await utils.reply(
|
||||||
message,
|
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
|
return
|
||||||
|
|
||||||
|
@ -90,8 +90,7 @@ class ChannelResponseWrapper:
|
|||||||
self.sent_message = None
|
self.sent_message = None
|
||||||
|
|
||||||
async def send_message(self, **kwargs):
|
async def send_message(self, **kwargs):
|
||||||
if "ephemeral" in kwargs:
|
kwargs.pop("ephemeral", None)
|
||||||
del kwargs["ephemeral"]
|
|
||||||
self.sent_message = await reply(self.message, **kwargs)
|
self.sent_message = await reply(self.message, **kwargs)
|
||||||
|
|
||||||
async def edit_message(self, content=None, embed=None, view=None):
|
async def edit_message(self, content=None, embed=None, view=None):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user