【问题标题】:TypeError: Cannot read properties of undefined (reading 'send')TypeError:无法读取未定义的属性(读取“发送”)
【发布时间】:2022-01-24 23:03:33
【问题描述】:

我正在用 node.js 编写一个不和谐的机器人。我希望机器人在成员加入或离开频道时自动发送消息。但是我不断收到有关发送功能的错误。你能帮助我吗? [1]:https://i.stack.imgur.com/4URud.png

module.exports = (client) => {
    client.on('guildMemberRemove', (member) => {
        console.log(member);
        
    member.guild.channels.cache.get("1234567890912345678").send("byeee");
  });
}

【问题讨论】:

    标签: javascript node.js discord.js


    【解决方案1】:

    member.guild.channels.cache.get("1234567890912345678") 未定义,因此没有send() 函数。您需要确定该频道未定义或不存在的原因,或者使用其他方法找到该频道。

    【讨论】:

      猜你喜欢
      • 2023-03-09
      • 1970-01-01
      • 2020-06-17
      • 2021-11-02
      • 2022-01-24
      • 2021-04-12
      • 2021-06-27
      • 2021-04-17
      • 2020-08-10
      相关资源
      最近更新 更多