我如何向上述频道发布公告?

How would I make an announcement go to the mentioned channel?

我要怎么做才能让你说 ;announce #channel message?因此,它不是在您编写消息的频道中发送它,而是将它发送到您提到的频道?

if (message.content.toLowerCase().startsWith(prefix + `announce`)) {
  if (message.member.hasPermission("ADMINISTRATOR")) {
    let args = message.content.split(" ").slice(1).join(" ");
    let split = args.split("-");
    let url = args[2];
    message.channel.sendMessage("@everyone", {
      embed: {
        color: 0xFFFF00,
        title: "New Announcement!",
        description: split[0],
        url: split[1],
        timestamp: new Date(),
        footer: {
          icon_url: message.author.avatarURL,
          text: message.author.username
        }
      }
    });
  }
}

Message.mentions includes every mention in the message, and its property .channels 为您提供提到的每个频道。
知道您可以从提及中获取频道,然后将其从参数中删除。

这是一个例子:

if (message.content.toLowerCase().startsWith(prefix + `announce`)) {
  if (message.member.hasPermission("ADMINISTRATOR")) {
    // I've added this part
    let channel = message.mentions.channels.first(); // you get the first mentioned channel
    if (!channel) return message.reply("No channel mentioned."); // if it doesn't exist, you exit
    let args = message.content.split(" ").slice(2).join(" "); // if it exist, you remove the command AND the channel

    let split = args.split("-");
    let url = args[2];
    channel.sendMessage("@everyone", { // here you send it to your channel instead of the same one
      embed: {
        color: 0xFFFF00,
        title: "New Announcement!",
        description: split[0],
        url: split[1],
        timestamp: new Date(),
        footer: {
          icon_url: message.author.avatarURL,
          text: message.author.username
        }
      }
    });
  }
}