Hello I am trying to run a minecraft bot with Mineflayer and want it to connect to my discord so I can receive and send messages when I run the code it sends me an error saying: "[Symbol(code)]: 'CLIENT_MISSING_INTENTS'" Can anyone help me with solving it? Thank you
const mineflayer = require("mineflayer");
const client = new Discord.Client();
let prefix = "."
let bot = mineflayer.createBot({
version: "1.8.9",
host: "best.jartex.fun",
auth: "microsoft",
port: 25565,
//Account Icly
username: "############@gmail.com",
password: "########"
})
client.on("ready", async => {
console.log("Bot started")
})
bot.on("login", async => {
console.log("Icly is joining Skyblock [Loading]")
bot.chat("/play skyblock")
})
bot.on("message", message => {
let.channel = client.channels.cache.get("##################")
if (!channel) return;
channel.send('${message}')
})
client.login("####################.#######.###########################")```
In discord.js v13, Intents were introduced which helped developers to choose which type of data their bot needed to recieved. To stop the error all you have to do is change your line of code where you create your client to:
const { Client, Intents } = require('discord.js')
const client = new Client({
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES
]
})
You can learn more about intents here Intents | discord.js