Update nodejs/controller/commands/invite.js

This commit is contained in:
Ethan Ethan 2024-01-09 01:16:28 +00:00
parent 38cb7829c2
commit 28f98762bb

View File

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