-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
31 lines (26 loc) · 932 Bytes
/
index.js
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
const mineflayer = require('mineflayer')
const options = {
host: 'mc.hypixel.net',
auth: 'microsoft',
username: process.argv[2],
version: '1.8.9'
}
const bot = mineflayer.createBot(options)
var client
bot.on('spawn', () => {
console.log(`Successfully connected to ${options.host} as ${bot.username}`)
})
bot.on('message', msg => {
let text = msg.getText()
if (text.includes("❤") && text.includes("❈") && text.includes("✎")) return
if (text.includes("has invited you to join their party!")) {
if (text.includes("]")) client = text.substring(text.indexOf("]") + 2, text.indexOf("has") - 1)
else client = text.substring(0, text.indexOf("has") - 1)
bot.chat(`/p accept ${client}`)
console.log(`Joined ${client}'s party`)
setTimeout(() => {
bot.chat(`/p leave`)
console.log(`Left ${client}'s party`)
}, 5000)
}
})