我正在努力做到这一点,以便在 Minecraft 聊天中发送的任何内容也通过我的机器人发送到 Discord 频道。它会在游戏中收到消息,但不会发布到 Discord 频道。(我是 JavaScript 新手)
const Discord = require('discord.js');
const mineflayer = require('mineflayer');
const client = new Discord.Client();
var bot = mineflayer.createBot({
host: "localhost",
port: 62146,
username: "email",
password: "password",
});
client.on('ready', () => {
console.log(`Connected!`)
console.log(`Username: ${client.user.tag}`);
});
bot.on('chat', function(username, message) {
if (username === bot.username) return;
bot.chat(message)
});
client.on("message", function(message) {
client.channels.get()("500693869684326430").send(message)
});
client.login('');
我希望它发送用户发送的消息,以便发送到定义的 Discord 频道。