def can_use_command(cmd: Command, author, channel: discord.Channel=None):
""" Return True if the member who sent the message can use this command. """
if cmd.owner and not is_owner(author):
return False
if channel is not None and not has_permissions(cmd, author, channel):
return False
if not has_roles(cmd, author):
return False
# Handle server specific commands for both server and PM commands
if type(author) is discord.User and cmd.servers:
return False
if type(author) is discord.Member and not is_valid_server(cmd, author.server):
return False
return True
评论列表
文章目录