【发布时间】:2021-12-21 16:51:44
【问题描述】:
这是我的代码
const Discord = require('discord.js');
const { Client, Intents } = require('discord.js');
const client = new Client({ intents: [4611] });
let targetChannel = '906686653874176090' //target channel
client.once('ready', () => {
console.log('Ready! - Made By Woodington');
});
client.on('messageCreate', gotMessage);
function gotMessage(msg) {
if (msg.channel.id !== targetChannel) {
client.channels.fetch(targetChannel)
.then(channel => channel.send(msg.content + `${client.user.tag}`))
.catch(console.error);
}
}
它的作用是将消息转发到另一个频道,底部带有用户不和谐标签。但是,它会发送机器人 Discord 名称而不是原始发件人。有什么想法吗?
【问题讨论】:
标签: javascript node.js discord discord.js