(timer): Various bugfixes.
This commit is contained in:
@@ -325,6 +325,9 @@ class Timer:
|
|||||||
"""
|
"""
|
||||||
Remove the timer.
|
Remove the timer.
|
||||||
"""
|
"""
|
||||||
|
# Remove timer from cache
|
||||||
|
self.timers.pop(self.channelid)
|
||||||
|
|
||||||
# Cancel the loop
|
# Cancel the loop
|
||||||
if self._run_task:
|
if self._run_task:
|
||||||
self._run_task.cancel()
|
self._run_task.cancel()
|
||||||
@@ -424,5 +427,5 @@ async def touch_member(client, member, before, after):
|
|||||||
await timer.update_last_status()
|
await timer.update_last_status()
|
||||||
|
|
||||||
if before.channel and (timer := Timer.fetch_timer(before.channel.id)):
|
if before.channel and (timer := Timer.fetch_timer(before.channel.id)):
|
||||||
timer.last_seen.pop(member.id)
|
timer.last_seen.pop(member.id, None)
|
||||||
await timer.update_last_status()
|
await timer.update_last_status()
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ async def _pomo_admin(ctx, flags):
|
|||||||
splits = ctx.args.split(maxsplit=1)
|
splits = ctx.args.split(maxsplit=1)
|
||||||
assume_channel = not (',' in splits[0])
|
assume_channel = not (',' in splits[0])
|
||||||
assume_channel = assume_channel and not (channel and len(splits[0]) < 5)
|
assume_channel = assume_channel and not (channel and len(splits[0]) < 5)
|
||||||
assume_channel = assume_channel and (splits[0].strip('#<>').isdigit() or len(splits[0]) > 10)
|
assume_channel = assume_channel or (splits[0].strip('#<>').isdigit() and len(splits[0]) > 10)
|
||||||
if assume_channel:
|
if assume_channel:
|
||||||
# Assume first argument is a channel specifier
|
# Assume first argument is a channel specifier
|
||||||
channel = await ctx.find_channel(
|
channel = await ctx.find_channel(
|
||||||
@@ -269,7 +269,7 @@ async def _pomo_admin(ctx, flags):
|
|||||||
)
|
)
|
||||||
if e.msg:
|
if e.msg:
|
||||||
usage.description = e.msg
|
usage.description = e.msg
|
||||||
return ctx.reply(embed=usage)
|
return await ctx.reply(embed=usage)
|
||||||
|
|
||||||
# Input validation complete, assign values
|
# Input validation complete, assign values
|
||||||
focus_length = int(timesplits[0])
|
focus_length = int(timesplits[0])
|
||||||
@@ -282,7 +282,7 @@ async def _pomo_admin(ctx, flags):
|
|||||||
# First check number of timers
|
# First check number of timers
|
||||||
timers = Timer.fetch_guild_timers(ctx.guild.id)
|
timers = Timer.fetch_guild_timers(ctx.guild.id)
|
||||||
if len(timers) >= MAX_TIMERS_PER_GUILD:
|
if len(timers) >= MAX_TIMERS_PER_GUILD:
|
||||||
return ctx.error_reply(
|
return await ctx.error_reply(
|
||||||
"Cannot create another timer!\n"
|
"Cannot create another timer!\n"
|
||||||
"This server already has the maximum of `{}` timers.".format(MAX_TIMERS_PER_GUILD)
|
"This server already has the maximum of `{}` timers.".format(MAX_TIMERS_PER_GUILD)
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user