【问题标题】:How to send an embed located in another file?如何发送位于另一个文件中的嵌入?
【发布时间】:2021-11-13 20:03:59
【问题描述】:

我想从我的help.js 发送一个嵌入,由main.js 代码触发。 这是我一直在尝试的:

const { Client, Message, MessageEmbed } = require("discord.js");


module.exports = {
  name: "say",
  
  execute: async (client, message, args) => {
    const sayEmbed = new MessageEmbed()
    my embed
    .settimestamp();
 message.channel.send(sayEmbed)
  }
};

但我总是收到此错误:

UnhandledPromiseRejectionWarning:DiscordAPIError:无法发送空消息

【问题讨论】:

  • 你没有设置描述
  • 我设置了但还是不行
  • 你在使用 discord.js V13 吗?
  • 是的,我使用 v13
  • 如果您对问题中的代码进行了更改,您能否更新它?

标签: javascript node.js discord.js


【解决方案1】:

在 Discord v13 上,您需要发送嵌入内容略有不同,试试吧:

message.channel.send({embeds: [sayEmbed]});

【讨论】:

    猜你喜欢
    • 2010-09-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-05
    • 2021-10-24
    • 2020-09-26
    • 1970-01-01
    相关资源
    最近更新 更多