def unlocked_or_allowed(ctx: commands.Context) -> bool:
""" Checks if a timer is unlocked, or if the author of the command
has permissions to execute such command on a locked timer.
:param ctx: The context to check the command in
:type ctx: commands.Context
:return: True if the command succeeds, else raises an exception.
:raises: commands.CheckFailure: If the check fails.
message : "timer locked"
"""
if isinstance(ctx.bot, PomodoroBot) and \
ctx.bot.is_locked(lib.get_channel(ctx)) and \
not ctx.bot.has_permission(ctx.message.author):
raise commands.CheckFailure(message="timer locked")
return True
评论列表
文章目录