我在其他用户的问题中查找,找到了我正在寻找的内容。我的问题是,我希望同一个机器人在不同的频道上使用不同的标题、页脚等执行相同的工作......
主要代码是:
const Discord = require("discord.js");
const client = new Discord.Client();
const channel = client.channels.cache.get("channel id");
client.on("ready", async () => {
console.log(`Bot has started`);
client.user.setPresence({ activity: { name: "some status " }, status: "online" });
});
client.on("message", (message) => {
if (message.author.bot)
return;
const embed = new MessageEmbed()
.setDescription(message.content)
.setTitle("")
.setAuthor(message.author.tag,message.author.displayAvatarURL())
.setImage(message.attachments.first().url)
.setFooter("", "")
.setTimestamp();
channel.send(embed).catch(console.error);
});
client.login("token");
大话西游666
相关分类