fix (timers): Add command ready check.
This commit is contained in:
@@ -4,6 +4,7 @@ import asyncio
|
|||||||
|
|
||||||
import discord
|
import discord
|
||||||
from discord.ext import commands as cmds
|
from discord.ext import commands as cmds
|
||||||
|
from discord.ext.commands.errors import CheckFailure
|
||||||
from discord import app_commands as appcmds
|
from discord import app_commands as appcmds
|
||||||
|
|
||||||
from meta import LionCog, LionBot, LionContext
|
from meta import LionCog, LionBot, LionContext
|
||||||
@@ -74,6 +75,19 @@ class TimerCog(LionCog):
|
|||||||
)
|
)
|
||||||
self.timers.clear()
|
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]):
|
async def _load_timers(self, timer_data: list[TimerData.Timer]):
|
||||||
"""
|
"""
|
||||||
Factored method to load a list of timers from data rows.
|
Factored method to load a list of timers from data rows.
|
||||||
|
|||||||
Reference in New Issue
Block a user