【问题标题】:Cannot read property 'send' of undefined in discord.js无法读取 discord.js 中未定义的属性“发送”
【发布时间】:2018-12-01 06:24:21
【问题描述】:

所以我试图编写一个不和谐的机器人,将每个频道中每条消息的名称和 ID 发送到管理频道,但它说它无法读取发送的属性?有什么想法吗?(我或多或少是 javascript 新手,但我了解 discord.js 的基础知识)

    bot.on('message',(message) =>{
bot.channels.get(459435599850504212).send(message.author.tag + ' ' + message.author.id)})

我知道它会循环回答自己,但我只想修复发送。

【问题讨论】:

    标签: bots discord.js


    【解决方案1】:

    频道 ID 应该用引号引起来。

    bot.channels.get('459435599850504212')
    

    Discord.js 的 id 不是整数,如果您正在获取/查找数据,请确保将其用引号括起来

    【讨论】:

      猜你喜欢
      • 2021-04-16
      • 2020-06-05
      • 2021-04-26
      • 1970-01-01
      • 2020-06-17
      • 2021-11-02
      • 1970-01-01
      • 2021-04-12
      • 2021-06-27
      相关资源
      最近更新 更多