working state again
This commit is contained in:
parent
fe602510e5
commit
d95e00bef3
1 changed files with 14 additions and 10 deletions
|
@ -12,12 +12,12 @@ class borgarCommand extends Command {
|
||||||
category: 'minigame',
|
category: 'minigame',
|
||||||
args: [
|
args: [
|
||||||
{
|
{
|
||||||
id: 'IngredientNumber',
|
id: 'ingredientNumber',
|
||||||
type: 'int',
|
type: 'int',
|
||||||
default: 4
|
default: 4
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'Time',
|
id: 'time',
|
||||||
type: 'int',
|
type: 'int',
|
||||||
default: 10000
|
default: 10000
|
||||||
}
|
}
|
||||||
|
@ -33,32 +33,36 @@ class borgarCommand extends Command {
|
||||||
async exec(message, args) {
|
async exec(message, args) {
|
||||||
const ingredient = [ 'bun', 'beef', 'salade', 'tomato', 'cheese', 'pickle'];
|
const ingredient = [ 'bun', 'beef', 'salade', 'tomato', 'cheese', 'pickle'];
|
||||||
let hamIngredient = [];
|
let hamIngredient = [];
|
||||||
for (let i = 0; i < args.IngredientNumber; i++) {
|
for (let i = 0; i < args.ingredientNumber; i++) {
|
||||||
hamIngredient[i] = ingredient[Math.floor( Math.random() * ingredient.length )];
|
hamIngredient[i] = ingredient[Math.floor( Math.random() * ingredient.length )];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const borgarEmbed = new MessageEmbed()
|
const borgarEmbed = new MessageEmbed()
|
||||||
.setTitle('hamborger delivery')
|
.setTitle('hamborger delivery')
|
||||||
.setDescription(`could you do me an **amborgar** that contain ${hamIngredient}`)
|
.setDescription(`could you do me an **amborgar** that contain **${hamIngredient}**`)
|
||||||
.setFooter('Level 0 | you have 10 seconds to make that hamborgor')
|
.setFooter('Level 0 | you have 10 seconds to make that hamborgor')
|
||||||
.setTimestamp();
|
.setTimestamp();
|
||||||
|
|
||||||
message.channel.send(borgarEmbed);
|
message.channel.send(borgarEmbed);
|
||||||
|
|
||||||
const filter = m => m.content;
|
const filter = m => m.content;
|
||||||
message.channel.awaitMessages(filter, { time: 10000, errors: ['time'] })
|
message.channel.awaitMessages(filter, { time: args.time, errors: ['time'] })
|
||||||
.catch(collected => {
|
.catch(collected => {
|
||||||
console.log(collected.map(collected => collected.content));
|
console.log(collected.map(collected => collected.content));
|
||||||
let userIngredient = collected.map(collected => collected.content);
|
let userIngredient = collected.map(collected => collected.content);
|
||||||
for (let i = 0; i < hamIngredient.length; i++) {
|
console.log(hamIngredient + '\n' + userIngredient);
|
||||||
if (userIngredient[i] == hamIngredient[i]) {
|
if (userIngredient.toString() == hamIngredient.toString()) {
|
||||||
return message.channel.send('u won bro,,,, that\'s kinda epic if i do say so myself');
|
return message.channel.send('u won bro,,,, that\'s kinda epic if i do say so myself');
|
||||||
|
} else {
|
||||||
|
if (userIngredient.length == hamIngredient.length) {
|
||||||
|
return message.channel.send(`you failed noob... you were supposed to make ${hamIngredient}`);
|
||||||
|
} else if (userIngredient.length > hamIngredient.length) {
|
||||||
|
return message.channel.send('Too much ingredient...');
|
||||||
} else {
|
} else {
|
||||||
return message.channel.send(`you failed at **${userIngredient[i]}** it should have been **${hamIngredient[i]}** noob...`);
|
return message.channel.send('time runned out noob...');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue