multi bots online
This commit is contained in:
16
nodejs/controller/commands/default.js
Normal file
16
nodejs/controller/commands/default.js
Normal file
@ -0,0 +1,16 @@
|
||||
module.exports = {
|
||||
'help': {
|
||||
desc: `Print the allowed commands.`,
|
||||
async function(from){
|
||||
console.log('called help', from)
|
||||
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 || ''}`
|
||||
));
|
||||
}
|
||||
}
|
||||
};
|
161
nodejs/controller/commands/fun.js
Normal file
161
nodejs/controller/commands/fun.js
Normal file
@ -0,0 +1,161 @@
|
||||
let ballOptions = [
|
||||
"It is certain.",
|
||||
"It is decidedly so.",
|
||||
"Without a doubt.",
|
||||
"Yes definitely.",
|
||||
"You may rely on it.",
|
||||
"As I see it, yes.",
|
||||
"Most likely.",
|
||||
"Outlook good.",
|
||||
"The Core gods will it to be!",
|
||||
"Yes.",
|
||||
"Signs point to yes.",
|
||||
"Reply hazy, try again.",
|
||||
"You should ask Ethan",
|
||||
"Ask again later.",
|
||||
"Better not tell you now.",
|
||||
"Cannot predict now.",
|
||||
"Concentrate and ask again.",
|
||||
"You will find the answers during you journey to The Core!",
|
||||
"Don't count on it.",
|
||||
"My reply is no.",
|
||||
"My sources say no.",
|
||||
"Outlook not so good.",
|
||||
"Very doubtful.",
|
||||
];
|
||||
|
||||
|
||||
module.exports = {
|
||||
'8ball':{
|
||||
desc: `magic 8 Ball pick.`,
|
||||
async function(from){
|
||||
await this.say(
|
||||
`> The 8 Ball says...`,
|
||||
`> ${ballOptions[Math.floor(Math.random()*ballOptions.length)]}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// bot.addCommand("joke", {
|
||||
// desc: "Tells a random joke.",
|
||||
// async function(from){
|
||||
// await this.say('> Let me think...');
|
||||
// let res = await axios.get('https://v2.jokeapi.dev/joke/Any?type=single')
|
||||
// await this.say(...res.data.joke.split('\n').map(e => `> ${e}`));
|
||||
// },
|
||||
// });
|
||||
|
||||
// bot.addCommand("quote", {
|
||||
// desc: 'Say an inspirational quote.',
|
||||
// async function(from){
|
||||
// await this.say('> Right away!');
|
||||
// let res = await axios.get('https://zenquotes.io/api/random')
|
||||
// await this.say(`> ${res.data[0].q} -- ${res.data[0].a}`);
|
||||
// }
|
||||
// });
|
||||
|
||||
// bot.addCommand('west-quote', {
|
||||
// desc: `Say a random Kanye West quote.`,
|
||||
// async function(from) {
|
||||
// await this.say('> And here we go!');
|
||||
// let res = await axios.get('https://api.kanye.rest/');
|
||||
// await this.say(`> ${res.data.quote} -- Kanye West`);
|
||||
// }
|
||||
// });
|
||||
|
||||
// bot.addCommand('pink-quote', {
|
||||
// desc: `Say a random Pink Floyd quote.`,
|
||||
// async function(from) {
|
||||
// await this.say(
|
||||
// `> Rock 'n' Roll`,
|
||||
// `> ${pink_quotes[Math.floor(Math.random()*pink_quotes.length)]} -- Pink Floyd`
|
||||
// );
|
||||
// }
|
||||
// });
|
||||
|
||||
// bot.addCommand("fact", {
|
||||
// desc: `Say a random fact.`,
|
||||
// async function(from){
|
||||
// await this.say('> The internet says this is true?');
|
||||
// let res = await axios.get('https://uselessfacts.jsph.pl/random.json?language=en')
|
||||
// await this.say(
|
||||
// `> ${res.data.text}`,
|
||||
// `> source: ${res.data.source}`
|
||||
// );
|
||||
// }
|
||||
// });
|
||||
|
||||
// bot.addCommand("advice", {
|
||||
// desc: `Say some random advice.`,
|
||||
// async function(from){
|
||||
// await this.say('> Try this:');
|
||||
// let res = await axios.get('https://api.adviceslip.com/advice');
|
||||
// await this.say(`> ${res.data.slip.advice}`);
|
||||
// }
|
||||
// });
|
||||
|
||||
// bot.addCommand('idea', {
|
||||
// desc: `Say a random start up idea.`,
|
||||
// async function(from){
|
||||
// await this.say('> How about?');
|
||||
// let res = await axios.get('https://itsthisforthis.com/api.php?text')
|
||||
// await this.say(`> ${res.data}`);
|
||||
// }
|
||||
// });
|
||||
|
||||
// bot.addCommand('discord', {
|
||||
// desc: `Say the CJ discord invite link.`,
|
||||
// async function(from) {
|
||||
// await this.say('https://discord.gg/hyby9m8');
|
||||
// }
|
||||
// });
|
||||
|
||||
// bot.addCommand('dice',{
|
||||
// desc: `Roll a die. You can state the max size on the dice. Default is 6.`,
|
||||
// async function(from, size){
|
||||
// size = size || 6;
|
||||
// if(!Number.isInteger(Number(size))){
|
||||
// this.whisper(from, `${size} is not a whole number...`)
|
||||
// return ;
|
||||
// }
|
||||
// await this.say(
|
||||
// `> Rolling a dice for ${from}`,
|
||||
// `> ${Math.floor(Math.random()*size)+1}`
|
||||
// );
|
||||
// }
|
||||
// });
|
||||
|
||||
// bot.addCommand('random-player', {
|
||||
// desc: `Return a random online player.`,
|
||||
// async function(from){
|
||||
// let players = bot.getPlayers()
|
||||
|
||||
// delete players[bot.bot.entity.username]
|
||||
|
||||
// let keys = Object.keys(players);
|
||||
// let player = players[keys[ keys.length * Math.random() << 0]];
|
||||
|
||||
// await this.say(`> I pick [${player.lvl}]${player.username}`)
|
||||
// }
|
||||
// });
|
||||
|
||||
// bot.addCommand('flip', {
|
||||
// desc: `Flip a coin.`,
|
||||
// async function(from){
|
||||
// await this.say(
|
||||
// `> Flipping a coin for ${from}`,
|
||||
// `> ${!!(Math.floor(Math.random() * (3000 - 1500) + 1500)%2) ? "Heads" : "Tails"}`
|
||||
// );
|
||||
// }
|
||||
// });
|
||||
};
|
||||
|
||||
|
||||
|
7
nodejs/controller/commands/index.js
Normal file
7
nodejs/controller/commands/index.js
Normal file
@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
default: require('./default'),
|
||||
fun: require('./fun'),
|
||||
invite: require('./invite'),
|
||||
};
|
103
nodejs/controller/commands/invite.js
Normal file
103
nodejs/controller/commands/invite.js
Normal file
@ -0,0 +1,103 @@
|
||||
'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'],
|
||||
},
|
||||
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', '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'],
|
||||
},
|
||||
// city: {
|
||||
// bot: 'art',
|
||||
// desc: 'Invite to the city',
|
||||
// allowed: ['wmantly', 'useless666', 'tux4242', 'owenshorts', 'VinceNL', 'Ethan63020', 'Ethan63021']
|
||||
// },
|
||||
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'],
|
||||
},
|
||||
}
|
||||
|
||||
function getSiteFromBot(name){
|
||||
for(let site in sites){
|
||||
if(sites[site].bot === name){
|
||||
return sites[site];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
'inv': {
|
||||
desc: `Have bot.\n Site -- one'`,
|
||||
// allowed: townMemebers,
|
||||
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