在不和.py重写
在我的代码片段中,我尝试在不一致运行实际命令之前运行一个简单的check命令:
@command.before_invoke
async def check_perms(self, ctx): # being defined in a class
# if 'administrator' in bot.permissions <<< My goal
# pass and let the following command run
# else:
# Make the bot say it can't run an admin only action and raise a custom exception
在运行命令之前,如何检测bot本身是否具有管理员权限?我不想在每个命令中都添加try/except块。在
您可以使用内置的^{} :
相关问题 更多 >
编程相关推荐