diff --git a/commands/games/battle.js b/commands/games/battle.js index bcc3d85d..6f7a2818 100644 --- a/commands/games/battle.js +++ b/commands/games/battle.js @@ -103,14 +103,8 @@ module.exports = class BattleCommand extends Command { } } this.fighting.delete(msg.channel.id); - const userWin = userHP > oppoHP; - const winner = userWin ? `${msg.author} (${userHP}HP)` : `${opponent} (${oppoHP}HP)`; - const loser = userWin ? `${opponent} (${oppoHP}HP)` : `${msg.author} (${userHP}HP)`; - return msg.say(stripIndents` - The match is over! - **Winner**: ${winner} - **Loser**: ${loser} - `); + const winner = userHP > oppoHP ? msg.author : opponent; + return msg.say(`The match is over! Congrats, ${winner}!`); } catch (err) { this.fighting.delete(msg.channel.id); throw err; diff --git a/commands/games/captcha-quiz.js b/commands/games/captcha-quiz.js index 0a4ff215..b12835f6 100644 --- a/commands/games/captcha-quiz.js +++ b/commands/games/captcha-quiz.js @@ -1,6 +1,7 @@ const { Command } = require('discord.js-commando'); const { createCanvas, registerFont } = require('canvas'); const path = require('path'); +const pool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ23456789'.split(''); registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Captcha.ttf'), { family: 'Captcha' }); module.exports = class CaptchaQuizCommand extends Command { @@ -30,7 +31,7 @@ module.exports = class CaptchaQuizCommand extends Command { ctx.font = '26px Captcha'; ctx.rotate(-0.05); ctx.strokeText(text, 15, 26); - await msg.say( + await msg.reply( '**You have 15 seconds, what does the captcha say?**', { files: [{ attachment: canvas.toBuffer(), name: 'captcha-quiz.png' }] } ); @@ -38,13 +39,12 @@ module.exports = class CaptchaQuizCommand extends Command { max: 1, time: 15000 }); - if (!msgs.size) return msg.say(`Sorry, time is up! It was ${text}.`); - if (msgs.first().content !== text) return msg.say(`Nope, sorry, it's ${text}.`); - return msg.say('Nice job! 10/10! You deserve some cake!'); + if (!msgs.size) return msg.reply(`Sorry, time is up! It was ${text}.`); + if (msgs.first().content !== text) return msg.reply(`Nope, sorry, it's ${text}.`); + return msg.reply('Nice job! 10/10! You deserve some cake!'); } randomText(len) { - const pool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ23456789'.split(''); const result = []; for (let i = 0; i < len; i++) result.push(pool[Math.floor(Math.random() * pool.length)]); return result.join(''); diff --git a/commands/games/fishy.js b/commands/games/fishy.js index abfa0a33..14156906 100644 --- a/commands/games/fishy.js +++ b/commands/games/fishy.js @@ -22,6 +22,6 @@ module.exports = class FishyCommand extends Command { else rarity = 'rare'; const fish = fishes[rarity]; const worth = randomRange(fish.min, fish.max); - return msg.say(`You caught a ${fish.symbol}. I bet it'd sell for around $${worth}.`); + return msg.reply(`You caught a ${fish.symbol}. I bet it'd sell for around $${worth}.`); } }; diff --git a/commands/games/lottery.js b/commands/games/lottery.js index eeb9f43c..da4b2101 100644 --- a/commands/games/lottery.js +++ b/commands/games/lottery.js @@ -26,7 +26,7 @@ module.exports = class LotteryCommand extends Command { run(msg, { choices }) { const lotto = Array.from({ length: 6 }, () => Math.floor(Math.random() * 70) + 1); const similarities = lotto.filter((num, i) => choices[i] === num).length; - return msg.say(stripIndents` + return msg.reply(stripIndents` ${lotto.join(', ')} You matched **${similarities}** numbers, which gives you **${prizes[similarities]}**! Congrats! `); diff --git a/commands/games/math-quiz.js b/commands/games/math-quiz.js index 4a0a3da4..2929086f 100644 --- a/commands/games/math-quiz.js +++ b/commands/games/math-quiz.js @@ -42,7 +42,7 @@ module.exports = class MathQuizCommand extends Command { case '-': answer = value1 - value2; break; case '*': answer = value1 * value2; break; } - await msg.say(stripIndents` + await msg.reply(stripIndents` **You have 10 seconds to answer this question.** ${value1} ${operation} ${value2} `); @@ -50,8 +50,8 @@ module.exports = class MathQuizCommand extends Command { max: 1, time: 10000 }); - if (!msgs.size) return msg.say(`Sorry, time is up! It was ${answer}.`); - if (msgs.first().content !== answer.toString()) return msg.say(`Nope, sorry, it's ${answer}.`); - return msg.say('Nice job! 10/10! You deserve some cake!'); + if (!msgs.size) return msg.reply(`Sorry, time is up! It was ${answer}.`); + if (msgs.first().content !== answer.toString()) return msg.reply(`Nope, sorry, it's ${answer}.`); + return msg.reply('Nice job! 10/10! You deserve some cake!'); } }; diff --git a/commands/games/quiz.js b/commands/games/quiz.js index 82b334ff..d91ba774 100644 --- a/commands/games/quiz.js +++ b/commands/games/quiz.js @@ -54,7 +54,7 @@ module.exports = class QuizCommand extends Command { const correct = decodeURIComponent(body.results[0].correct_answer.toLowerCase()); answers.push(correct); const shuffled = shuffle(answers); - await msg.say(stripIndents` + await msg.reply(stripIndents` **You have 15 seconds to answer this question.** ${decodeURIComponent(body.results[0].question)} ${shuffled.map((answer, i) => `**${choices[i]}**. ${answer}`).join('\n')} @@ -64,10 +64,10 @@ module.exports = class QuizCommand extends Command { max: 1, time: 15000 }); - if (!msgs.size) return msg.say(`Sorry, time is up! It was ${correct}.`); + if (!msgs.size) return msg.reply(`Sorry, time is up! It was ${correct}.`); const win = shuffled[choices.indexOf(msgs.first().content.toUpperCase())] === correct; - if (!win) return msg.say(`Nope, sorry, it's ${correct}.`); - return msg.say('Nice job! 10/10! You deserve some cake!'); + if (!win) return msg.reply(`Nope, sorry, it's ${correct}.`); + return msg.reply('Nice job! 10/10! You deserve some cake!'); } catch (err) { return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); } diff --git a/commands/games/rock-paper-scissors.js b/commands/games/rock-paper-scissors.js index 99397845..065d7614 100644 --- a/commands/games/rock-paper-scissors.js +++ b/commands/games/rock-paper-scissors.js @@ -23,20 +23,20 @@ module.exports = class RockPaperScissorsCommand extends Command { run(msg, { choice }) { const response = choices[Math.floor(Math.random() * choices.length)]; if (choice === 'rock') { - if (response === 'rock') return msg.say('Rock! Aw... A tie...'); - if (response === 'paper') return msg.say('Paper! Yes! I win!'); - if (response === 'scissors') return msg.say('Scissors! Aw... I lose...'); + if (response === 'rock') return msg.reply('Rock! Aw... A tie...'); + if (response === 'paper') return msg.reply('Paper! Yes! I win!'); + if (response === 'scissors') return msg.reply('Scissors! Aw... I lose...'); } if (choice === 'paper') { - if (response === 'rock') return msg.say('Rock! Aw... I lose...'); - if (response === 'paper') return msg.say('Paper! Aw... A tie...'); - if (response === 'scissors') return msg.say('Scissors! Yes! I win!'); + if (response === 'rock') return msg.reply('Rock! Aw... I lose...'); + if (response === 'paper') return msg.reply('Paper! Aw... A tie...'); + if (response === 'scissors') return msg.reply('Scissors! Yes! I win!'); } if (choice === 'scissors') { - if (response === 'rock') return msg.say('Rock! Yes! I win!'); - if (response === 'paper') return msg.say('Paper! Aw... I lose...'); - if (response === 'scissors') return msg.say('Scissors! Aw... A tie...'); + if (response === 'rock') return msg.reply('Rock! Yes! I win!'); + if (response === 'paper') return msg.reply('Paper! Aw... I lose...'); + if (response === 'scissors') return msg.reply('Scissors! Aw... A tie...'); } - return msg.say('I win by default, you little cheater.'); + return msg.reply('I win by default, you little cheater.'); } }; diff --git a/commands/games/slots.js b/commands/games/slots.js index 375a4e4d..48a15229 100644 --- a/commands/games/slots.js +++ b/commands/games/slots.js @@ -17,12 +17,12 @@ module.exports = class SlotsCommand extends Command { const slotTwo = slots[Math.floor(Math.random() * slots.length)]; const slotThree = slots[Math.floor(Math.random() * slots.length)]; if (slotOne === slotTwo && slotOne === slotThree) { - return msg.say(stripIndents` + return msg.reply(stripIndents` ${slotOne}|${slotTwo}|${slotThree} Wow! You won! Great job... er... luck! `); } - return msg.say(stripIndents` + return msg.reply(stripIndents` ${slotOne}|${slotTwo}|${slotThree} Aww... You lost... Guess it's just bad luck, huh? `); diff --git a/commands/games/typing-test.js b/commands/games/typing-test.js index 302801b3..b2bce23d 100644 --- a/commands/games/typing-test.js +++ b/commands/games/typing-test.js @@ -35,7 +35,7 @@ module.exports = class TypingTestCommand extends Command { async run(msg, { difficulty }) { const sentence = sentences[Math.floor(Math.random() * sentences.length)]; const time = times[difficulty]; - await msg.say(stripIndents` + await msg.reply(stripIndents` **You have ${time / 1000} seconds to type this sentence.** ${sentence} `); @@ -44,7 +44,7 @@ module.exports = class TypingTestCommand extends Command { max: 1, time }); - if (!msgs.size || msgs.first().content !== sentence) return msg.say('Sorry! You lose!'); - return msg.say(`Nice job! 10/10! You deserve some cake! (Took ${(Date.now() - now) / 1000} seconds)`); + if (!msgs.size || msgs.first().content !== sentence) return msg.reply('Sorry! You lose!'); + return msg.reply(`Nice job! 10/10! You deserve some cake! (Took ${(Date.now() - now) / 1000} seconds)`); } }; diff --git a/commands/games/whos-that-pokemon.js b/commands/games/whos-that-pokemon.js index 0bf2804c..89fb5628 100644 --- a/commands/games/whos-that-pokemon.js +++ b/commands/games/whos-that-pokemon.js @@ -37,14 +37,14 @@ module.exports = class WhosThatPokemonCommand extends Command { const displayName = data.names.filter(name => name.language.name === 'en')[0].name; const id = data.id.toString().padStart(3, '0'); const attachment = await this.fetchImage(id, hide); - await msg.say('**You have 15 seconds, who\'s that Pokémon?**', { files: [{ attachment, name: `${id}.png` }] }); + await msg.reply('**You have 15 seconds, who\'s that Pokémon?**', { files: [{ attachment, name: `${id}.png` }] }); const msgs = await msg.channel.awaitMessages(res => res.author.id === msg.author.id, { max: 1, time: 15000 }); - if (!msgs.size) return msg.say(`Sorry, time is up! It was ${displayName}.`); - if (!names.includes(msgs.first().content.toLowerCase())) return msg.say(`Nope, sorry, it's ${displayName}.`); - return msg.say('Nice job! 10/10! You deserve some cake!'); + if (!msgs.size) return msg.reply(`Sorry, time is up! It was ${displayName}.`); + if (!names.includes(msgs.first().content.toLowerCase())) return msg.reply(`Nope, sorry, it's ${displayName}.`); + return msg.reply('Nice job! 10/10! You deserve some cake!'); } catch (err) { return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); } diff --git a/commands/number-edit/math.js b/commands/number-edit/math.js index c041da5f..7665ed60 100644 --- a/commands/number-edit/math.js +++ b/commands/number-edit/math.js @@ -22,9 +22,9 @@ module.exports = class MathCommand extends Command { run(msg, { expression }) { try { const evaluated = math.eval(expression).toString(); - return msg.say(evaluated).catch(() => msg.say('Invalid expression.')); + return msg.reply(evaluated).catch(() => msg.reply('Invalid expression.')); } catch (err) { - return msg.say('Invalid expression.'); + return msg.reply('Invalid expression.'); } } }; diff --git a/commands/util/whitelist.js b/commands/util/whitelist.js index 0714f590..1bf95937 100644 --- a/commands/util/whitelist.js +++ b/commands/util/whitelist.js @@ -4,7 +4,7 @@ module.exports = class WhitelistCommand extends Command { constructor(client) { super(client, { name: 'whitelist', - aliases: ['blacklist-remove', 'blacklist-delete'], + aliases: ['blacklist-remove', 'blacklist-delete', 'unblacklist'], group: 'util', memberName: 'whitelist', description: 'Removes a user from the blacklist.', diff --git a/package.json b/package.json index 57a141c4..bb9577a4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "75.1.1", + "version": "75.1.2", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {