From cbf7f786044352bff131f86d24c057379e369246 Mon Sep 17 00:00:00 2001 From: William Mantly Date: Fri, 7 Oct 2022 04:18:22 -0400 Subject: [PATCH] end outpost --- nodejs/controller/mc-bot.js | 11 +- nodejs/controller/mc-chatbot.js | 195 +++++++++++++------------------- 2 files changed, 86 insertions(+), 120 deletions(-) diff --git a/nodejs/controller/mc-bot.js b/nodejs/controller/mc-bot.js index 95555ac..9244963 100644 --- a/nodejs/controller/mc-bot.js +++ b/nodejs/controller/mc-bot.js @@ -23,8 +23,6 @@ const nova = new CJbot({ ...conf.mc.bots.nova }); -console.log('owen', conf.mc.bots.owen) - const owen = new CJbot({ host: conf.mc.server, autoConnect: false, @@ -46,5 +44,12 @@ const jimin = new CJbot({ ...conf.mc.bots.jimin }); +const ez = new CJbot({ + host: conf.mc.server, + autoConnect: false, + __autoReConnect: false, + ...conf.mc.bots.ez +}); -module.exports = {bot, henry, owen, linda, jimin, nova}; + +module.exports = {bot, henry, owen, linda, jimin, nova, ez}; diff --git a/nodejs/controller/mc-chatbot.js b/nodejs/controller/mc-chatbot.js index 24fb010..8f021fc 100644 --- a/nodejs/controller/mc-chatbot.js +++ b/nodejs/controller/mc-chatbot.js @@ -4,9 +4,13 @@ const axios = require('axios'); const {sleep} = require('../utils'); const conf = require('../conf'); -const {bot, henry, owen, linda, jimin, nova} = require('./mc-bot'); +const {bot, henry, owen, linda, jimin, nova, ez} = require('./mc-bot'); const pink_quotes = require('../model/pink_quotes') +let myAccounts = ['wmantly', 'useless666', 'tux4242'] + +let germans = ['YTMatze', 'mytzor'] + let townMemebers = [ 'wmantly', 'useless666', 'tux4242', 'VinceNL', @@ -46,132 +50,89 @@ let ballOptions = [ "Very doubtful.", ]; +let sites = { + city: { + bot: bot, + desc: 'Invite to the city', + allowed: townMemebers + }, + nd: { + bot: nova, + desc: `Get an invite to New Detroit.`, + allowed: townMemebers, + }, + sb: { + bot:owen, + desc: `Get an invite to the Sky Base.`, + allowed: ['wmantly', 'useless666', 'tux4242', 'owenshorts', 'VinceNL', 'Ethan63020', 'Ethan63021'], + }, + fo: { + bot: jimin, + desc: `Get an invite to the Farming outpost.`, + allowed: ['wmantly', 'useless666', 'tux4242', 'pi_chef'], + }, + fo2: { + bot:henry, + desc: `Get an invite to the Farming outpost 2.`, + allowed: ['wmantly', 'useless666', 'tux4242', 'pi_chef'], + }, + german: { + bot:linda, + desc: `Get an invite you Germans area.`, + allowed: ['wmantly', 'useless666', 'tux4242', 'owenshorts', 'VinceNL', 'Ethan63020', 'Ethan63021', 'pi_chef', 'YTMatze', 'mytzor'], + }, + foend: { + bot: ez, + desc: `Get an invite to the Farming outpost in the end.`, + allowed: ['wmantly', 'useless666', 'tux4242', 'pi_chef'], + }, +} + + +async function offSiteInvite(from, site){ + let offSiteBot = sites[site].bot + this.__unLockCommand(); + await offSiteBot.connect(); + await offSiteBot.bot.chat(`/invite ${from}`); + await this.whisper(from, `accept invite from ${offSiteBot.bot.entity.username} within 10 seconds...`) + let clear = setTimeout(()=>offSiteBot.quit(), 10000) + offSiteBot.on('message', (message) =>{ + if(message.toString() === `${from} teleported to you.`){ + offSiteBot.quit(); + } + }) +} + bot.addCommand('inv', { desc: `Have bot invite you to its position.`, allowed: townMemebers, - async function(from){ + async function(from, site){ await this.say(`/invite ${from}`); } }); -bot.addCommand('inv-nd', { - desc: `Get an invite to New Detroit.`, - ignoreLock: true, - allowed: townMemebers, - async function(from){ - this.__unLockCommand(); - await nova.connect(); - await nova.bot.chat(`/invite ${from}`); - await this.whisper(from, `accept invite from ${nova.bot.entity.username} in 10 seconds...`) - let clear = setTimeout(()=>nova.quit(), 10000) - nova.on('message', (message) =>{ - console.log(message.toString()) - if(message.toString() === `${from} teleported to you.`){ - nova.quit(); - } - }) - } -}); - -bot.addCommand('inv-sb', { - desc: `Get an invite to the Sky Base.`, - ignoreLock: true, - allowed: ['wmantly', 'useless666', 'tux4242', 'owenshorts', 'VinceNL', 'Ethan63020', 'Ethan63021'], - async function(from){ - this.__unLockCommand(); - await owen.connect(); - await owen.bot.chat(`/invite ${from}`); - await this.whisper(from, `accept invite from ${owen.bot.entity.username} in 10 seconds...`) - let clear = setTimeout(()=>owen.quit(), 10000) - owen.on('message', (message) =>{ - console.log(message.toString()) - if(message.toString() === `${from} teleported to you.`){ - owen.quit(); - } - }); - } -}); - -bot.addCommand('inv-german', { - desc: `Get an invite you Germans.`, - ignoreLock: true, - allowed: ['wmantly', 'useless666', 'tux4242', 'owenshorts', 'VinceNL', 'Ethan63020', 'Ethan63021', 'pi_chef'], - async function(from){ - this.__unLockCommand(); - await linda.connect(); - await linda.bot.chat(`/invite ${from}`); - await this.whisper(from, `accept invite from ${linda.bot.entity.username} in 10 seconds...`) - let clear = setTimeout(()=>linda.quit(), 10000) - linda.on('message', (message) =>{ - console.log(message.toString()) - if(message.toString() === `${from} teleported to you.`){ - linda.quit(); - } - }); - } -}); - -bot.addCommand('inv-fo', { - desc: `Get an invite to the Farming outpost.`, - ignoreLock: true, - allowed: ['wmantly', 'useless666', 'tux4242', 'pi_chef'], - async function(from){ - this.__unLockCommand(); - await jimin.connect(); - await jimin.bot.chat(`/invite ${from}`); - await this.whisper(from, `accept invite from ${jimin.bot.entity.username} in 10 seconds...`) - let clear = setTimeout(()=>jimin.quit(), 10000) - jimin.on('message', (message) =>{ - console.log(message.toString()) - if(message.toString() === `${from} teleported to you.`){ - jimin.quit(); - } - }); - } -}); - -bot.addCommand('inv-fo', { - desc: `Get an invite to the Farming outpost.`, - ignoreLock: true, - allowed: ['wmantly', 'useless666', 'tux4242', 'pi_chef'], - async function(from){ - this.__unLockCommand(); - await jimin.connect(); - await jimin.bot.chat(`/invite ${from}`); - await this.whisper(from, `accept invite from ${jimin.bot.entity.username} in 10 seconds...`) - let clear = setTimeout(()=>jimin.quit(), 10000) - jimin.on('message', (message) =>{ - console.log(message.toString()) - if(message.toString() === `${from} teleported to you.`){ - jimin.quit(); - } - }); - } -}); - -bot.addCommand('inv-fo2', { - desc: `Get an invite to the Farming outpost 2.`, - ignoreLock: true, - allowed: ['wmantly', 'useless666', 'tux4242', 'pi_chef'], - async function(from){ - this.__unLockCommand(); - await henry.connect(); - await henry.bot.chat(`/invite ${from}`); - await this.whisper(from, `accept invite from ${henry.bot.entity.username} in 10 seconds...`) - let clear = setTimeout(()=>henry.quit(), 10000) - henry.on('message', (message) =>{ - console.log(message.toString()) - if(message.toString() === `${from} teleported to you.`){ - henry.quit(); - } - }); - } -}); - +for(const [name, site] of Object.entries(sites)){ + bot.addCommand(`inv-${name}`, { + ...site, + ignoreLock: true, + async function(from){ + this.__unLockCommand(); + await site.bot.connect(); + await site.bot.bot.chat(`/invite ${from}`); + await this.whisper(from, `accept invite from ${site.bot.bot.entity.username} within 10 seconds...`) + let clear = setTimeout(()=>site.bot.quit(), 10000) + site.bot.on('message', (message) =>{ + if(message.toString() === `${from} teleported to you.`){ + site.bot.quit(); + } + }) + } + }) +} bot.addCommand('.invite', { desc: `The bot will /accept an /invite from you.`, - allowed: ['wmantly', 'useless666', 'tux4242', 'owenshorts', 'BobinaBlu'], + allowed: ['wmantly', 'useless666', 'tux4242', 'owenshorts', 'BobinaBlu', 'pi_chef'], async function(from){ await this.whisper('Coming'); await this.say(`/accept`);