为什么我的权限检查(Discordia机器人)总是返回false?

问题在第10行。无论我有什么角色或权限,我总是从我的机器人得到“您没有管理员或所需角色(测试消息)”消息。我以为是因为我使用了“and”而不是“or”,但这只能解决以前的问题(我无论拥有什么权限或管理员,都会被批准使用命令)。有人能解释一下我做错了什么吗? 编辑:我需要使用"and"而不是"or",并且我没有确保我的替代帐户中的管理员已被删除,我正在使用该帐户进行测试。

client:on("messageCreate", function(message)
        if message.author.bot == true then
        return end

    local author = message.guild:getMember(message.author.id)
    local authorRole = message.guild:getMember(message.member)

    if message.content == prefix.."Permissions" then
        for i, v in ipairs(roleswithpermission) do
            if not author:hasPermission("administrator") or not authorRole:hasRole(v) then
                message.channel:send("您没有管理员或所需角色(测试消息)")
            elseif author:hasPermission("administrator") or authorRole:hasRole(v) then
                message.channel:send("这是一个测试消息(意味着权限检查已经成功,您已经有权限)")
            end
        end
    end
end)
点赞