const mineflayer = require('mineflayer');
const config = {
host: '*****',
port: 25565,
username: '****@gmail.com',
password: '*****',
auth: 'microsoft',
version: '1.21.3',
loadInternalPlugins: true,
viewDistance: 1,
};
let bot;
function createBot() {
bot = mineflayer.createBot(config);
bot.on('spawn', () => {
console.log('[BOT] Bot spawned and AFK now.');
stayAFK();
});
bot.on('chat', (username, message) => {
const logMessage = `[CHAT] ${username}: ${message}`;
console.log(logMessage);
});
bot.on('error', (err) => {
const errorMessage = `[BOT] Error encountered: ${err}`;
console.error(errorMessage);
setTimeout(createBot, 180000);
});
bot.on('end', () => {
const disconnectMessage = '[BOT] Bot disconnected. Relogging...';
console.log(disconnectMessage);
setTimeout(createBot, 60000);
});
}
function stayAFK() {
setInterval(() => {
const afkMessage = '[BOT] Bot AFK: OK.';
console.log(afkMessage);
}, 60000);
}
createBot();
when my mineflayer bot spawns into Limbo, it crashes with error
/bot/node_modules/prismarine-chunk/src/pc/1.18/ChunkColumn.js:20
this.numSections = this.worldHeight >> 4
^
TypeError: Cannot mix BigInt and other types, use explicit conversions
at new ChunkColumn (/bot/node_modules/prismarine-chunk/src/pc/1.18/ChunkColumn.js:20:43)
at addColumn (/bot/node_modules/mineflayer/lib/plugins/blocks.js:53:16)
at Client. (/bot/node_modules/mineflayer/lib/plugins/blocks.js:296:5)
at Client.emit (node:events:517:28)
at emitPacket (/bot/node_modules/minecraft-protocol/src/client.js:84:12)
at FullPacketParser. (/bot/node_modules/minecraft-protocol/src/client.js:113:9)
at FullPacketParser.emit (node:events:517:28)
at addChunk (/bot/node_modules/readable-stream/lib/internal/streams/readable.js:323:12)
at readableAddChunk (/bot/node_modules/readable-stream/lib/internal/streams/readable.js:300:9)
at Readable.push (/bot/node_modules/readable-stream/lib/internal/streams/readable.js:246:10)