-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.js
More file actions
32 lines (25 loc) · 775 Bytes
/
Copy pathbot.js
File metadata and controls
32 lines (25 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const mineflayer = require('mineflayer');
const HOST = process.argv[2] || 'survie-mn3F.aternos.me';
const PORT = parseInt(process.argv[3]) || 53623;
const USERNAME = process.argv[4] || 'BotPersonnalise';
function createBot() {
const bot = mineflayer.createBot({
host: HOST,
port: PORT,
username: USERNAME,
});
bot.on('spawn', () => {
console.log(`Bot connecté sur ${HOST}:${PORT} en tant que ${USERNAME}`);
});
bot.on('end', () => {
console.log('Déconnecté, reconnexion dans 5s...');
setTimeout(createBot, 5000);
});
bot.on('error', err => {
console.log('Erreur:', err);
});
bot.on('chat', (username, message) => {
console.log(`[CHAT] ${username}: ${message}`);
});
}
createBot();