Update nodejs/controller/commands/invite.js #1
@ -1,117 +1,50 @@
|
|||||||
'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', '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', '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', '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', 'pi_chef', '1_cut', 'Ethan63020', 'Ethan63021', 'VinceNL', 'nootbot'],
|
|
||||||
},
|
|
||||||
core: {
|
|
||||||
bot: 'nova',
|
|
||||||
desc: `Get an invite to the Core.`,
|
|
||||||
allowed: ['wmantly', 'useless666', 'tux4242', 'pi_chef', '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 = {
|
module.exports = {
|
||||||
'.invite': {
|
'help': {
|
||||||
desc: `The bot will /accept an /invite from you.`,
|
desc: `Print the allowed commands.`,
|
||||||
allowed: ['wmantly', 'useless666', 'tux4242', 'owenshorts', 'pi_chef'],
|
|
||||||
ignoreLock: true,
|
|
||||||
async function(from){
|
async function(from){
|
||||||
await this.whisper('Coming');
|
console.log('called help', from)
|
||||||
await this.say(`/accept`);
|
let intro = [
|
||||||
|
'I am a bot owned and operated by',
|
||||||
|
'wmantly <wmantly@gmail.com>',
|
||||||
|
'You have access to the following commands:'
|
||||||
|
]
|
||||||
|
await this.whisper(from, ...intro, ...this.__reduceCommands(from).map(command =>
|
||||||
|
`${command} -- ${this.commands[command].desc || ''}`
|
||||||
|
));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'inv': {
|
'say': {
|
||||||
desc: `Have bot.\n Site -- one'`,
|
desc: `Make the bot say stuff in chat`,
|
||||||
|
allowed: ['wmantly', 'useless666', 'tux4242', 'pi_chef', '1_cut',],
|
||||||
ignoreLock: true,
|
ignoreLock: true,
|
||||||
async function(from, site){
|
async function(from, ...messages){
|
||||||
|
await this.say((messages || []).join(' '));
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
'logon': {
|
||||||
|
desc: `Have bot log on for 10 seconds'`,
|
||||||
|
allowed: ['wmantly', 'useless666', 'tux4242', 'pi_chef', '1_cut',],
|
||||||
|
ignoreLock: true,
|
||||||
|
async function(from, botName){
|
||||||
this.__unLockCommand();
|
this.__unLockCommand();
|
||||||
|
|
||||||
if(sites[site] && sites[site].allowed.includes(from)){
|
if(botName in his.constructor.bots){
|
||||||
let bot = this.constructor.bots[sites[site].bot];
|
let bot = this.constructor.bots[botName];
|
||||||
|
|
||||||
if(!bot.isReady){
|
if(!bot.isReady){
|
||||||
try{
|
try{
|
||||||
await bot.connect();
|
await bot.connect();
|
||||||
|
var clear = setTimeout(()=> bot.quit(), 10000);
|
||||||
|
bot.whisper(from, 'I am ready')
|
||||||
}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);
|
}else{
|
||||||
|
await this.whisper(from, `Bot ${bot.bot.entity.username} Already online`);
|
||||||
}
|
}
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user