fix (timers): Add command ready check.

This commit is contained in:
2023-08-22 22:54:44 +03:00
parent 4ddece1e0f
commit 319f132d5d

View File

@@ -4,6 +4,7 @@ import asyncio
import discord
from discord.ext import commands as cmds
from discord.ext.commands.errors import CheckFailure
from discord import app_commands as appcmds
from meta import LionCog, LionBot, LionContext
@@ -74,6 +75,19 @@ class TimerCog(LionCog):
)
self.timers.clear()
async def cog_check(self, ctx: LionContext):
if not self.ready:
raise CheckFailure(
self.bot.translator.t(_p(
'cmd_check:ready|failed',
"I am currently restarting! "
"The Pomodoro timers will be unavailable until I have restarted. "
"Thank you for your patience!"
))
)
else:
return True
async def _load_timers(self, timer_data: list[TimerData.Timer]):
"""
Factored method to load a list of timers from data rows.