mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-14 08:08:34 +02:00
msg
This commit is contained in:
@@ -10,10 +10,10 @@ module.exports = class LotteryCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
run(message) {
|
||||
run(msg) {
|
||||
const lottery = Math.floor(Math.random() * 100) + 1;
|
||||
if (lottery < 99)
|
||||
return message.say(`Nope, sorry ${message.author.username}, you lost.`);
|
||||
return message.say(`Wow ${message.author.username}! You actually won! Great job!`);
|
||||
return msg.say(`Nope, sorry ${msg.author.username}, you lost.`);
|
||||
return msg.say(`Wow ${msg.author.username}! You actually won! Great job!`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -24,10 +24,10 @@ module.exports = class MathGameCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
async run(msg, args) {
|
||||
if (msg.channel.type !== 'dm')
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
const { difficulty } = args;
|
||||
const operation = operations[Math.floor(Math.random() * operations.length)];
|
||||
let value;
|
||||
@@ -55,18 +55,18 @@ module.exports = class MathGameCommand extends Command {
|
||||
const embed = new RichEmbed()
|
||||
.setTitle('You have **10** seconds to answer:')
|
||||
.setDescription(expression);
|
||||
await message.embed(embed);
|
||||
await msg.embed(embed);
|
||||
try {
|
||||
const collected = await message.channel.awaitMessages(response => response.author.id === message.author.id, {
|
||||
const collected = await msg.channel.awaitMessages(res => res.author.id === msg.author.id, {
|
||||
max: 1,
|
||||
time: 10000,
|
||||
errors: ['time']
|
||||
});
|
||||
if (collected.first().content !== solved)
|
||||
return message.say(`Aw... Too bad, try again next time!\nThe correct answer is: ${solved}`);
|
||||
return message.say(`Good Job! You won! ${solved} is the correct answer!`);
|
||||
return msg.say(`Aw... Too bad, try again next time!\nThe correct answer is: ${solved}`);
|
||||
return msg.say(`Good Job! You won! ${solved} is the correct answer!`);
|
||||
} catch (err) {
|
||||
return message.say(`Aw... Too bad, try again next time!\nThe correct answer is: ${solved}`);
|
||||
return msg.say(`Aw... Too bad, try again next time!\nThe correct answer is: ${solved}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
+10
-10
@@ -15,10 +15,10 @@ module.exports = class QuizCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
async run(msg) {
|
||||
if (msg.channel.type !== 'dm')
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
try {
|
||||
const { body } = await request
|
||||
.get('http://jservice.io/api/random?count=1');
|
||||
@@ -26,21 +26,21 @@ module.exports = class QuizCommand extends Command {
|
||||
const embed = new RichEmbed()
|
||||
.setTitle('You have **15** seconds to answer this question:')
|
||||
.setDescription(`**Category: ${body[0].category.title}**\n${body[0].question}`);
|
||||
await message.embed(embed);
|
||||
await msg.embed(embed);
|
||||
try {
|
||||
const collected = await message.channel.awaitMessages(res => res.author.id === message.author.id, {
|
||||
const collected = await msg.channel.awaitMessages(res => res.author.id === msg.author.id, {
|
||||
max: 1,
|
||||
time: 15000,
|
||||
errors: ['time']
|
||||
});
|
||||
if (collected.first().content.toLowerCase() !== answer)
|
||||
return message.say(`The correct answer is: ${answer}`);
|
||||
return message.say(`Perfect! The correct answer is: ${answer}`);
|
||||
return msg.say(`The correct answer is: ${answer}`);
|
||||
return msg.say(`Perfect! The correct answer is: ${answer}`);
|
||||
} catch (err) {
|
||||
return message.say(`Aw... Too bad, try again next time!\nThe Correct Answer was: ${answer}`);
|
||||
return msg.say(`Aw... Too bad, try again next time!\nThe Correct Answer was: ${answer}`);
|
||||
}
|
||||
} catch (err) {
|
||||
return message.say('An Unknown Error Occurred.');
|
||||
return msg.say('An Unknown Error Occurred.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -25,30 +25,30 @@ module.exports = class RockPaperScissorsCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
run(message, args) {
|
||||
run(msg, args) {
|
||||
const { choice } = args;
|
||||
const response = responses[Math.floor(Math.random() * responses.length)];
|
||||
if (choice === 'rock') {
|
||||
if (response === 'Rock')
|
||||
return message.say('Rock! Aw, it\'s a tie!');
|
||||
return msg.say('Rock! Aw, it\'s a tie!');
|
||||
if (response === 'Paper')
|
||||
return message.say('Paper! Yes! I win!');
|
||||
return msg.say('Paper! Yes! I win!');
|
||||
if (response === 'Scissors')
|
||||
return message.say('Scissors! Aw... I lose...');
|
||||
return msg.say('Scissors! Aw... I lose...');
|
||||
} else if (choice === 'paper') {
|
||||
if (response === 'Rock')
|
||||
return message.say('Rock! Aw... I lose...');
|
||||
return msg.say('Rock! Aw... I lose...');
|
||||
if (response === 'Paper')
|
||||
return message.say('Paper! Aw, it\'s a tie!');
|
||||
return msg.say('Paper! Aw, it\'s a tie!');
|
||||
if (response === 'Scissors')
|
||||
return message.say('Scissors! Yes! I win!');
|
||||
return msg.say('Scissors! Yes! I win!');
|
||||
} else if (choice === 'scissors') {
|
||||
if (response === 'Rock')
|
||||
return message.say('Rock! Yes! I win!');
|
||||
return msg.say('Rock! Yes! I win!');
|
||||
if (response === 'Paper')
|
||||
return message.say('Paper! Aw... I lose...');
|
||||
return msg.say('Paper! Aw... I lose...');
|
||||
if (response === 'Scissors')
|
||||
return message.say('Scissors! Aw, it\'s a tie!');
|
||||
return msg.say('Scissors! Aw, it\'s a tie!');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -11,12 +11,12 @@ module.exports = class SlotsCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
run(message) {
|
||||
run(msg) {
|
||||
const slotOne = slotThing[Math.floor(Math.random() * slotThing.length)];
|
||||
const slotTwo = slotThing[Math.floor(Math.random() * slotThing.length)];
|
||||
const slotThree = slotThing[Math.floor(Math.random() * slotThing.length)];
|
||||
if (slotOne === slotTwo && slotOne === slotThree)
|
||||
return message.say(`${slotOne}|${slotTwo}|${slotThree}\nWow! You won! Great job... er... luck!`);
|
||||
return message.say(`${slotOne}|${slotTwo}|${slotThree}\nAww... You lost... Guess it's just bad luck, huh?`);
|
||||
return msg.say(`${slotOne}|${slotTwo}|${slotThree}\nWow! You won! Great job... er... luck!`);
|
||||
return msg.say(`${slotOne}|${slotTwo}|${slotThree}\nAww... You lost... Guess it's just bad luck, huh?`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -23,10 +23,10 @@ module.exports = class TypingGameCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
async run(msg, args) {
|
||||
if (msg.channel.type !== 'dm')
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
const { difficulty } = args;
|
||||
const sentence = sentences[Math.floor(Math.random() * sentences.length)];
|
||||
let time;
|
||||
@@ -50,18 +50,18 @@ module.exports = class TypingGameCommand extends Command {
|
||||
const embed = new RichEmbed()
|
||||
.setTitle(`You have **${time / 1000}** seconds to type:`)
|
||||
.setDescription(sentence);
|
||||
await message.embed(embed);
|
||||
await msg.embed(embed);
|
||||
try {
|
||||
const collected = await message.channel.awaitMessages(response => response.author.id === message.author.id, {
|
||||
const collected = await msg.channel.awaitMessages(res => res.author.id === msg.author.id, {
|
||||
max: 1,
|
||||
time: time,
|
||||
errors: ['time']
|
||||
});
|
||||
if (collected.first().content !== sentence)
|
||||
return message.say('Nope, your sentence does not match the original. Try again next time!');
|
||||
return message.say(`Good Job! You won!`);
|
||||
return msg.say('Nope, your sentence does not match the original. Try again next time!');
|
||||
return msg.say(`Good Job! You won!`);
|
||||
} catch (err) {
|
||||
return message.say('Aw... Too bad, try again next time!');
|
||||
return msg.say('Aw... Too bad, try again next time!');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user