【发布时间】:2021-02-18 13:22:23
【问题描述】:
当我尝试使用 kick 命令时,它显示TypeError: message.author.hasPermission is not a function。如果您没有KICK_MEMBERS 的权限,我希望它不起作用。
这是我返回错误的代码:
if (!message.author.hasPermission("KICK_MEMBERS")) return;
【问题讨论】:
标签: discord.js
当我尝试使用 kick 命令时,它显示TypeError: message.author.hasPermission is not a function。如果您没有KICK_MEMBERS 的权限,我希望它不起作用。
这是我返回错误的代码:
if (!message.author.hasPermission("KICK_MEMBERS")) return;
【问题讨论】:
标签: discord.js
message.author 返回一个User 类,它没有.hasPermission 方法。
我认为您正在寻找 message.member,它返回一个 GuildMember。
if (!message.member.hasPermission("KICK_MEMBERS")) return;
【讨论】: