Haha-Yes/commands/minigame/borgar.js

71 lines
2.2 KiB
JavaScript
Raw Normal View History

2019-06-17 23:03:50 +02:00
// TODO:
// Make a level system per user and increasse difficutly based on the level
// higher the level the more ingredient required
// higher the level the less time you have to complete it
const { Command } = require('discord-akairo');
const { MessageEmbed } = require('discord.js');
class borgarCommand extends Command {
constructor() {
super('borgar', {
2019-06-18 00:13:17 +02:00
aliases: ['borgar', 'hamburgor', 'hamborgar', 'burger', 'hamburger', 'borger'],
2019-06-17 23:03:50 +02:00
category: 'minigame',
args: [
{
2019-06-17 23:38:17 +02:00
id: 'ingredientNumber',
2019-06-18 01:14:36 +02:00
type: 'number',
default: 4
},
{
2019-06-17 23:38:17 +02:00
id: 'time',
2019-06-18 01:14:36 +02:00
type: 'number',
2019-06-18 00:08:07 +02:00
default: 10
}
],
2019-06-17 23:03:50 +02:00
description: {
content: 'Make amborgar,,,,,,,,,, ( MINI GAME VERY WIP, NO LEVEL YET )',
2019-06-18 00:07:12 +02:00
usage: '[number of ingredient] [time]',
2019-06-18 00:11:03 +02:00
examples: ['4 10']
2019-06-17 23:03:50 +02:00
}
});
}
async exec(message, args) {
if (args.time <= 0) args.time = 1;
2019-06-18 00:49:53 +02:00
const ingredients = [ 'bun', 'beef', 'salade', 'tomato', 'cheese', 'pickle', 'onion', 'garlic', 'basil'];
2019-06-17 23:03:50 +02:00
let hamIngredient = [];
2019-06-17 23:38:17 +02:00
for (let i = 0; i < args.ingredientNumber; i++) {
2019-06-18 00:49:53 +02:00
hamIngredient[i] = ingredients[Math.floor( Math.random() * ingredients.length )];
2019-06-17 23:03:50 +02:00
}
const borgarEmbed = new MessageEmbed()
.setTitle('hamborger delivery')
2019-06-17 23:38:17 +02:00
.setDescription(`could you do me an **amborgar** that contain **${hamIngredient}**`)
2019-06-18 00:08:54 +02:00
.setFooter(`Level 0 | you have ${args.time} seconds to make that hamborgor`)
2019-06-17 23:03:50 +02:00
.setTimestamp();
message.channel.send(borgarEmbed);
const filter = m => m.content && m.author.id == message.author.id;
2019-06-18 00:07:12 +02:00
message.channel.awaitMessages(filter, {time: args.time * 1000, errors: ['time'] })
2019-06-17 23:03:50 +02:00
.catch(collected => {
let userIngredient = collected.map(collected => collected.content);
2019-06-18 00:49:53 +02:00
if (userIngredient.toString().toLowerCase() == hamIngredient.toString()) {
return message.reply('u won bro,,,, that\'s kinda epic if i do say so myself');
2019-06-17 23:38:17 +02:00
} else {
if (userIngredient.length == hamIngredient.length) {
return message.reply(`you failed noob... you were supposed to make ${hamIngredient}`);
2019-06-17 23:38:17 +02:00
} else if (userIngredient.length > hamIngredient.length) {
return message.reply('Too much ingredient...');
2019-06-17 23:03:50 +02:00
} else {
return message.reply('time runned out noob...');
2019-06-17 23:03:50 +02:00
}
}
});
}
}
module.exports = borgarCommand;