Update nodejs/controller/commands/invite.js #1
| @ -1,117 +0,0 @@ | |||||||
| 'use strict'; |  | ||||||
|  |  | ||||||
| const {sleep} = require('../../utils'); |  | ||||||
|  |  | ||||||
| let myAccounts = ['wmantly', 'useless666', 'tux4242'] |  | ||||||
|  |  | ||||||
| let germans = ['YTMatze', 'mytzor'] |  | ||||||
|  |  | ||||||
| let townMemebers = [ |  | ||||||
| 	'wmantly', 'useless666', 'tux4242',  |  | ||||||
| 	'VinceNL', |  | ||||||
| 	'Ethan63020', 'Ethan63021',  |  | ||||||
| 	'pi_chef',  |  | ||||||
| 	'EXLAlphaWolf', 'Sillychubbs', |  | ||||||
| 	'BearSkates420', 'hloop',  |  | ||||||
| 	'ogeiDNight', 'BobinaBlu', 'Roby_G_27', |  | ||||||
| 	'kawiimeowz', 'RaindropCake24', 'KimiKava', |  | ||||||
| 	'Keebyys', |  | ||||||
| 	'YTMatze', 'mytzor', |  | ||||||
| 	'jj_disaster', 'Cuttaway', |  | ||||||
| 	'sonic_joe', |  | ||||||
| ] |  | ||||||
|  |  | ||||||
| let sites = { |  | ||||||
| 	fo: { |  | ||||||
| 		bot: 'jimin', |  | ||||||
| 		desc: `Get an invite to the Farming outpost.`, |  | ||||||
| 		allowed: ['wmantly', 'useless666', 'tux4242', 'pi_chef', '1_cut', 'nootbot', 'VinceNL', 'Ethan63020', 'Ethan63021', 'KimiKava', 'kawiimeowz', 'RaindropCake24', 'AndyNyg', 'AndyNyg_II'], |  | ||||||
| 	}, |  | ||||||
| 	guardian: { |  | ||||||
| 		bot: 'art', |  | ||||||
| 		desc: 'blah', |  | ||||||
| 		allowed: ['wmantly', 'useless666', 'tux4242', 'pi_chef', '1_cut', 'Ethan63020', 'Ethan63021', 'VinceNL', 'nootbot'], |  | ||||||
| 	}, |  | ||||||
| 	fo2: { |  | ||||||
| 		bot: 'henry', |  | ||||||
| 		desc: `Get an invite to the Farming outpost 2.`, |  | ||||||
| 		allowed: ['wmantly', 'useless666', 'tux4242', 'pi_chef', '1_cut', 'Ethan63020', 'Ethan63021', 'VinceNL', 'nootbot'], |  | ||||||
| 	}, |  | ||||||
| 	foend: { |  | ||||||
| 		bot: 'ez', |  | ||||||
| 		desc: `Get an invite to the Farming outpost in the end.`, |  | ||||||
| 		allowed: ['wmantly', 'useless666', 'tux4242', 'pi_chef', '1_cut',], |  | ||||||
| 	}, |  | ||||||
| 	sb: { |  | ||||||
| 		bot: 'owen', |  | ||||||
| 		desc: `Get an invite to the Sky Base.`, |  | ||||||
| 		allowed: ['wmantly', 'useless666', 'tux4242', 'pi_chef', '1_cut', 'Ethan63020', 'Ethan63021', 'VinceNL', 'nootbot'], |  | ||||||
| 	}, |  | ||||||
| 	core: { |  | ||||||
| 		bot: 'nova', |  | ||||||
| 		desc: `Get an invite to the Core.`, |  | ||||||
| 		allowed: ['wmantly', 'useless666', 'tux4242', 'pi_chef', '1_cut', 'Ethan63020', 'Ethan63021', 'VinceNL', 'nootbot', 'AndyNyg', 'AndyNyg_II','Lost_Imback', 'KimiKava', 'kawiimeowz', 'RaindropCake24',], |  | ||||||
| 	}, |  | ||||||
| 	art: { |  | ||||||
| 		bot: 'art', |  | ||||||
| 		desc: 'Invite to art', |  | ||||||
| 		allowed: ['wmantly', 'useless666', 'tux4242'] |  | ||||||
| 	}, |  | ||||||
| 	german: { |  | ||||||
| 		bot: 'linda', |  | ||||||
| 		desc: `Get an invite you Germans area.`, |  | ||||||
| 		allowed: ['wmantly', 'useless666', 'tux4242', 'owenshorts', 'VinceNL', 'Ethan63020', 'Ethan63021', 'pi_chef', 'YTMatze', 'mytzor', 'pi_chef', '1_cut', 'nootbot', 'Lost_Imback',], |  | ||||||
| 	}, |  | ||||||
| } |  | ||||||
|  |  | ||||||
| function getSiteFromBot(name){ |  | ||||||
| 	for(let site in sites){ |  | ||||||
| 		if(sites[site].bot === name){ |  | ||||||
| 			return sites[site]; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
|  |  | ||||||
| module.exports = { |  | ||||||
| 	'.invite': { |  | ||||||
| 		desc: `The bot will /accept an /invite from you.`, |  | ||||||
| 		allowed: ['wmantly', 'useless666', 'tux4242', 'owenshorts', 'pi_chef', '1_cut',], |  | ||||||
| 		ignoreLock: true, |  | ||||||
| 		async function(from){ |  | ||||||
| 			await this.whisper('Coming'); |  | ||||||
| 			await this.say(`/accept`); |  | ||||||
| 		} |  | ||||||
| 	}, |  | ||||||
| 	'inv': { |  | ||||||
| 		desc: `Have bot.\n  Site -- one'`, |  | ||||||
| 		ignoreLock: true, |  | ||||||
| 		async function(from, site){ |  | ||||||
| 			this.__unLockCommand(); |  | ||||||
|  |  | ||||||
| 			if(sites[site] && sites[site].allowed.includes(from)){ |  | ||||||
| 				let bot = this.constructor.bots[sites[site].bot]; |  | ||||||
|  |  | ||||||
| 				if(!bot.isReady){ |  | ||||||
| 					try{ |  | ||||||
| 						await bot.connect(); |  | ||||||
| 					}catch(error){ |  | ||||||
| 						console.log('inv error connecting to bot'); |  | ||||||
| 						this.whisper('Bot is not available right now, try again in 30 seconds.'); |  | ||||||
| 					} |  | ||||||
| 					var clear = setTimeout(()=> bot.quit(), 10000); |  | ||||||
| 				} |  | ||||||
| 				await bot.bot.chat(`/invite ${from}`); |  | ||||||
| 				await bot.whisper(from, `accept invite from ${bot.bot.entity.username} within 10 seconds...`); |  | ||||||
| 				bot.on('message', (message) =>{ |  | ||||||
| 					if(message.toString() === `${from} teleported to you.`){ |  | ||||||
| 						if(clear){ |  | ||||||
| 							clearTimeout(clear); |  | ||||||
| 							bot.quit(); |  | ||||||
| 						} |  | ||||||
| 					} |  | ||||||
| 				}); |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 	}, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
		Reference in New Issue
	
	Block a user