44 lines
No EOL
1.3 KiB
JavaScript
44 lines
No EOL
1.3 KiB
JavaScript
const readline = require('readline')
|
|
const rl = readline.createInterface({
|
|
input: process.stdin,
|
|
output: process.stdout,
|
|
prefix: '> '
|
|
})
|
|
|
|
const { createBots } = require('./bot.js')
|
|
const command_handler = require('./commands.js')
|
|
|
|
const servers = [
|
|
'kaboom.pw:25565:kaboom',
|
|
's.veast.network:25565:kaboom',
|
|
//'clone.tk:25565:kaboom',
|
|
'legunepw.apexmc.co:25565:kaboom',
|
|
'ssandcat.aternos.me:25565:vanilla'
|
|
]
|
|
|
|
const bots = createBots(servers, {
|
|
username: 'chipmunkbot',
|
|
prefix: `'`,
|
|
colors: { primary: 'green', secondary: 'dark_green', error: 'red' },
|
|
version: '1.17.1',
|
|
//'online-mode': { enabled: false, username: 'removed lol', password: null }
|
|
})
|
|
|
|
bots.forEach((bot) => {
|
|
bot.on('login', () => {
|
|
rl.prompt(true)
|
|
rl.on('line', (line) => {
|
|
if (line.startsWith('c:'))
|
|
bot.core.run(`/sudo ${bot._client.uuid} c:${line.slice(2)}`)
|
|
else if (line.startsWith('.')) {
|
|
const args = line.slice(1).split(' ')
|
|
const command = args.shift()
|
|
if (!command_handler.isCommand(command))
|
|
return console.log(`Unknown command: ${command}`)
|
|
command_handler.execute(bot, command, bot.player, args)
|
|
} else
|
|
bot.fancyMsg(`${bot._client.username} Console`, '_ChipMC_', line)
|
|
rl.prompt(true)
|
|
})
|
|
})
|
|
}) |