def has_permission(ctx: commands.Context) -> bool:
""" Checks if a user is an administrator or if has the role
that grants elevated permissions.
: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 : "no permissions"
"""
if isinstance(ctx.bot, PomodoroBot) and \
ctx.bot.has_permission(ctx.message.author):
return True
raise commands.CheckFailure(message="no permissions")
评论列表
文章目录