Make admins not kick each other

倾然丶 夕夏残阳落幕 提交于 2020-06-29 03:57:06

问题


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!')

But I get an error.

TypeError: message.author.hasPermission is not a function


回答1:


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').

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().



来源:https://stackoverflow.com/questions/62342075/make-admins-not-kick-each-other

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!