mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-13 08:19:08 +02:00
More Clean-Ups
This commit is contained in:
@@ -12,7 +12,8 @@ module.exports = class LotteryCommand extends Command {
|
||||
|
||||
run(message) {
|
||||
const lottery = Math.floor(Math.random() * 100) + 1;
|
||||
if (lottery < 99) return message.say(`Nope, sorry ${message.author.username}, you lost.`);
|
||||
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!`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -62,9 +62,8 @@ module.exports = class MathGameCommand extends Command {
|
||||
time: 10000,
|
||||
errors: ['time']
|
||||
});
|
||||
if (collected.first().content !== solved.toString()) {
|
||||
if (collected.first().content !== solved.toString())
|
||||
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!`);
|
||||
} catch (err) {
|
||||
return message.say(`Aw... Too bad, try again next time!\nThe correct answer is: ${solved}`);
|
||||
|
||||
@@ -34,9 +34,8 @@ module.exports = class QuizCommand extends Command {
|
||||
time: 15000,
|
||||
errors: ['time']
|
||||
});
|
||||
if (collected.first().content.toLowerCase() !== answer) {
|
||||
if (collected.first().content.toLowerCase() !== answer)
|
||||
return message.say(`The correct answer is: ${answer}`);
|
||||
}
|
||||
return message.say(`Perfect! The correct answer is: ${answer}`);
|
||||
} catch (err) {
|
||||
return message.say(`Aw... Too bad, try again next time!\nThe Correct Answer was: ${answer}`);
|
||||
|
||||
@@ -63,9 +63,8 @@ module.exports = class TypingGameCommand extends Command {
|
||||
time: time,
|
||||
errors: ['time']
|
||||
});
|
||||
if (collected.first().content !== sentence) {
|
||||
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!`);
|
||||
} catch (err) {
|
||||
return message.say('Aw... Too bad, try again next time!');
|
||||
|
||||
@@ -12,6 +12,7 @@ module.exports = class EmojiCommand extends Command {
|
||||
}
|
||||
|
||||
run(message) {
|
||||
return message.say(message.guild.emojis.map(e => e).join('')).catch(() => message.say(':x: Error! Perhaps you have no custom emoji?'));
|
||||
return message.say(message.guild.emojis.map(e => e).join(''))
|
||||
.catch(() => message.say(':x: Error! Perhaps you have no custom emoji?'));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -48,6 +48,7 @@ module.exports = class MemeCommand extends Command {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('ATTACH_FILES'))
|
||||
return message.say(':x: Error! I don\'t have the Attach Files Permission!');
|
||||
const { type, toprow, bottomrow } = args;
|
||||
return message.channel.send({files: [`https://memegen.link/${type}/${toprow}/${bottomrow}.jpg`]});
|
||||
return message.channel.send({files: [`https://memegen.link/${type}/${toprow}/${bottomrow}.jpg`]})
|
||||
.catch(() => message.say(':x: Error! Something went wrong!'));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -20,7 +20,8 @@ module.exports = class MathCommand extends Command {
|
||||
const { expression } = args;
|
||||
try {
|
||||
const solved = math.eval(expression);
|
||||
return message.say(solved).catch(() => message.say(':x: Error! Invalid statement!'));
|
||||
return message.say(solved)
|
||||
.catch(() => message.say(':x: Error! Invalid statement!'));
|
||||
} catch (err) {
|
||||
return message.say(':x: Error! Invalid statement!');
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ module.exports = class GoogleCommand extends Command {
|
||||
.get(`https://www.google.com/search?q=${query}`);
|
||||
const $ = cheerio.load(text);
|
||||
let href = $('.r').first().find('a').first().attr('href');
|
||||
if (!href) throw new Error('No Results');
|
||||
href = querystring.parse(href.replace('/url?', ''));
|
||||
return msg.edit(href.q);
|
||||
} catch (err) {
|
||||
|
||||
@@ -28,7 +28,8 @@ module.exports = class NeopetCommand extends Command {
|
||||
.get(`http://www.sunnyneo.com/petimagefinder.php?name=${pet}&size=5&mood=1`);
|
||||
const $ = cheerio.load(text);
|
||||
const link = $('textarea').first().text();
|
||||
if (!link.includes('cp')) return message.say(':x: Error! Pet not found!');
|
||||
if (!link.includes('cp'))
|
||||
return message.say(':x: Error! Pet not found!');
|
||||
return message.say(link);
|
||||
} catch (err) {
|
||||
return message.say(':x: Error! Something went wrong!');
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiaobot",
|
||||
"version": "32.0.4",
|
||||
"version": "32.1.0",
|
||||
"description": "A Discord Bot",
|
||||
"main": "shardingmanager.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user