【问题标题】:message.author.hasPermission is not a function in Discord.js [duplicate]message.author.hasPermission 不是 Discord.js 中的函数 [重复]
【发布时间】: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


    【解决方案1】:

    message.author 返回一个User 类,它没有.hasPermission 方法。

    我认为您正在寻找 message.member,它返回一个 GuildMember


    if (!message.member.hasPermission("KICK_MEMBERS")) return;
    

    【讨论】:

      猜你喜欢
      • 2021-01-13
      • 2020-09-03
      • 2022-01-17
      • 2020-09-02
      • 2021-12-15
      • 2020-12-31
      • 2020-12-07
      • 2020-08-23
      • 2020-01-22
      相关资源
      最近更新 更多