【问题标题】:Send is not a function discord.js v12发送不是函数 discord.js v12
【发布时间】:2021-02-10 00:30:37
【问题描述】:

我对 discord JavaScript 版本 12 有疑问。 我收到此错误,但我更改了查找功能。 他还能有什么?

upBot.send is not a function
let upBot = bot.channels.cache.find(ch => ch.id = "");
    let upBotEmbed = new Discord.MessageEmbed()
        .setColor(colours.red_light)
        .addField(`${bot.user.username} online`, datetime)
        .setFooter(`Test`, bot.user.displayAvatarURL);
        upBot.send(upBotEmbed).then(m => m.delete(900000))

【问题讨论】:

  • 我们帮不了你; upSend 没有在您提供给我们的代码中的任何地方调用。
  • 对不起,upBot.send
  • 表示频道ID不正确或者频道没有被bot缓存。
  • 身份证是正确的...
  • 这是你准备好的活动吗?

标签: node.js discord discord.js


【解决方案1】:

您收到此错误的原因是您没有正确使用删除超时。

改变

.delete(900000)

.delete({ timeout: 900000 })

delete 属性采用 v12 版本中的对象。

【讨论】:

    【解决方案2】:

    find 函数应该返回一个对象列表。试试这个:

    ...
    for(const upBot of upBots) {
        upBot.send(upBotEmbed).then(m => m.delete(900000))
    }
    

    【讨论】:

      猜你喜欢
      • 2021-09-22
      • 2020-09-02
      • 1970-01-01
      • 2021-11-02
      • 1970-01-01
      • 2021-03-02
      • 2021-04-14
      • 1970-01-01
      • 2020-10-19
      相关资源
      最近更新 更多