目前需要在消息中提及该频道,但我希望将其发送到ID为[('employee_id','child_of', 'employee_parent_id')]
的频道。我该怎么做?
497100331956830218
答案 0 :(得分:2)
您可能需要使用以前的代码,并使用Guild.channels.get()
使用ID来获取频道。
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];
let id = 'YOUR ID HERE AS A STRING';
let channel = message.guild.channels.get(id);
if (!channel) return message.reply(`Cant find channel \`${id}\` in your guild.`);
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
}
}
});
}
}