让管理员不要互相踢 [英] Make admins not kick each other

查看:67
本文介绍了让管理员不要互相踢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

发出踢球命令。

我试图发出命令,以使管理员不能互相踢球。

Making a kick command.
I am trying to make a command so that the admins cannot kick each other.

if(message.author.hasPermission('KICK_MEMBER', 'ADMINISTRATOR') && message.member.hasPermission('KICK_MEMBER', 'ADMINISTRATOR'))
    return ('You cant kick another admin!')

但是出现错误。


TypeError:message.author.hasPermission不是一个函数

TypeError: message.author.hasPermission is not a function


推荐答案

因此,基本上,您正在尝试使用 message.author.hasPermission (权限)。消息对象的属性 author User ,它是Discord用户。您需要使用 message.member.hasPermission('permission')引用 GuildMember

So basically you are trying to use message.author.hasPermission('permission'). The property author of the message object is a User, which is a Discord user. You need to reference the GuildMember, using message.member.hasPermission('permission').

此外,您似乎正在尝试比较同一个人( message.author message.member 是同一个人,只有一个是 User ,另一个是 GuildMember ) 。您需要将 message.member.hasPermission() otherMember.hasPermission()进行比较。

Also, it looks like you are trying to compare the same person (message.author and message.member are the same person, only one is a User and the other is a GuildMember). You need to compare message.member.hasPermission() with otherMember.hasPermission().

这篇关于让管理员不要互相踢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆