From c0cda06749f2f1c05197e2131a901ff4cd352312 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Sun, 7 Jun 2020 08:54:04 -0400 Subject: [PATCH] Export command leaderboard on shutdown command --- commands/edit-meme/chi-idea.js | 2 +- commands/edit-meme/edd-facts-book.js | 2 +- commands/edit-meme/genie-rules.js | 2 +- commands/edit-meme/gru-plan.js | 2 +- commands/edit-meme/illegal.js | 2 +- commands/edit-meme/lisa-presentation.js | 2 +- commands/edit-meme/phoebe-teaching-joey.js | 2 +- commands/edit-meme/plankton-plan.js | 2 +- commands/edit-meme/scroll-of-truth.js | 2 +- commands/edit-meme/sos.js | 2 +- commands/edit-meme/spongebob-burn.js | 2 +- commands/edit-meme/two-buttons.js | 4 ++-- commands/games-mp/connect-four.js | 2 +- commands/other/prune.js | 2 +- commands/random-res/lorem-ipsum.js | 2 +- commands/util/shutdown.js | 2 ++ package.json | 2 +- 17 files changed, 19 insertions(+), 17 deletions(-) diff --git a/commands/edit-meme/chi-idea.js b/commands/edit-meme/chi-idea.js index e0e124d8..5473e4a5 100644 --- a/commands/edit-meme/chi-idea.js +++ b/commands/edit-meme/chi-idea.js @@ -58,7 +58,7 @@ module.exports = class ChiIdeaCommand extends Command { ctx.font = '15px Wild Words'; let fontSize = 15; while (ctx.measureText(text).width > 500) { - fontSize -= 1; + fontSize--; ctx.font = `${fontSize}px Wild Words`; } const lines = await wrapText(ctx, text, 83); diff --git a/commands/edit-meme/edd-facts-book.js b/commands/edit-meme/edd-facts-book.js index fc0ecbc6..3fd3446b 100644 --- a/commands/edit-meme/edd-facts-book.js +++ b/commands/edit-meme/edd-facts-book.js @@ -54,7 +54,7 @@ module.exports = class EddFactsBookCommand extends Command { ctx.font = '30px Noto'; let fontSize = 30; while (ctx.measureText(fact).width > 458) { - fontSize -= 1; + fontSize--; ctx.font = `${fontSize}px Noto`; } const lines = await wrapText(ctx, fact, 183); diff --git a/commands/edit-meme/genie-rules.js b/commands/edit-meme/genie-rules.js index b3b8b727..2a109536 100644 --- a/commands/edit-meme/genie-rules.js +++ b/commands/edit-meme/genie-rules.js @@ -55,7 +55,7 @@ module.exports = class GenieRulesCommand extends Command { ctx.font = '40px Noto'; let fontSize = 40; while (ctx.measureText(text).width > 1143) { - fontSize -= 1; + fontSize--; ctx.font = `${fontSize}px Noto`; } const lines = await wrapText(ctx, text, 381); diff --git a/commands/edit-meme/gru-plan.js b/commands/edit-meme/gru-plan.js index 21346903..93bb9142 100644 --- a/commands/edit-meme/gru-plan.js +++ b/commands/edit-meme/gru-plan.js @@ -74,7 +74,7 @@ module.exports = class GruPlanCommand extends Command { const step = steps[i]; let fontSize = 35; while (ctx.measureText(step).width > 1100) { - fontSize -= 1; + fontSize--; ctx.font = `${fontSize}px Noto`; } const lines = await wrapText(ctx, step, 252); diff --git a/commands/edit-meme/illegal.js b/commands/edit-meme/illegal.js index 1c3b0ecc..8115fcdd 100644 --- a/commands/edit-meme/illegal.js +++ b/commands/edit-meme/illegal.js @@ -62,7 +62,7 @@ module.exports = class IllegalCommand extends Command { let fontSize = 45; ctx.font = `${fontSize}px Noto`; while (ctx.measureText(illegalText).width > 550) { - fontSize -= 1; + fontSize--; ctx.font = `${fontSize}px Noto`; } const lines = await wrapText(ctx, illegalText, 200); diff --git a/commands/edit-meme/lisa-presentation.js b/commands/edit-meme/lisa-presentation.js index 59053f74..c3a816d9 100644 --- a/commands/edit-meme/lisa-presentation.js +++ b/commands/edit-meme/lisa-presentation.js @@ -54,7 +54,7 @@ module.exports = class LisaPresentationCommand extends Command { ctx.font = '40px Noto'; let fontSize = 40; while (ctx.measureText(text).width > 1320) { - fontSize -= 1; + fontSize--; ctx.font = `${fontSize}px Noto`; } const lines = await wrapText(ctx, text, 330); diff --git a/commands/edit-meme/phoebe-teaching-joey.js b/commands/edit-meme/phoebe-teaching-joey.js index f7b3baf2..aa7ab74b 100644 --- a/commands/edit-meme/phoebe-teaching-joey.js +++ b/commands/edit-meme/phoebe-teaching-joey.js @@ -87,7 +87,7 @@ module.exports = class PhoebeTeachingJoeyCommand extends Command { if (step === incorrect && j === 0) step = correct.join(' '); let fontSize = 20; while (ctx.measureText(step).width > 260) { - fontSize -= 1; + fontSize--; ctx.font = `${fontSize}px Noto`; } ctx.strokeText(step, x, y, 260); diff --git a/commands/edit-meme/plankton-plan.js b/commands/edit-meme/plankton-plan.js index bb0a47ab..986f1082 100644 --- a/commands/edit-meme/plankton-plan.js +++ b/commands/edit-meme/plankton-plan.js @@ -74,7 +74,7 @@ module.exports = class PlanktonPlanCommand extends Command { const step = steps[i]; let fontSize = 35; while (ctx.measureText(step).width > 420) { - fontSize -= 1; + fontSize--; ctx.font = `${fontSize}px Noto`; } const lines = await wrapText(ctx, step, 155); diff --git a/commands/edit-meme/scroll-of-truth.js b/commands/edit-meme/scroll-of-truth.js index 42a5bda6..ab24c515 100644 --- a/commands/edit-meme/scroll-of-truth.js +++ b/commands/edit-meme/scroll-of-truth.js @@ -54,7 +54,7 @@ module.exports = class ScrollOfTruthCommand extends Command { ctx.font = '60px Noto'; let fontSize = 60; while (ctx.measureText(text).width > 542) { - fontSize -= 1; + fontSize--; ctx.font = `${fontSize}px Noto`; } const lines = await wrapText(ctx, text, 217); diff --git a/commands/edit-meme/sos.js b/commands/edit-meme/sos.js index 286d0a08..024d699d 100644 --- a/commands/edit-meme/sos.js +++ b/commands/edit-meme/sos.js @@ -54,7 +54,7 @@ module.exports = class SosCommand extends Command { ctx.rotate(15 * (Math.PI / 180)); let fontSize = 90; while (ctx.measureText(message).width > 140) { - fontSize -= 1; + fontSize--; ctx.font = `${fontSize}px Noto`; } ctx.fillText(message.toUpperCase(), 362, 522); diff --git a/commands/edit-meme/spongebob-burn.js b/commands/edit-meme/spongebob-burn.js index 2b0d6378..738dadae 100644 --- a/commands/edit-meme/spongebob-burn.js +++ b/commands/edit-meme/spongebob-burn.js @@ -61,7 +61,7 @@ module.exports = class SpongebobBurnCommand extends Command { ctx.font = '35px Noto'; let fontSize = 35; while (ctx.measureText(burn).width > 400) { - fontSize -= 1; + fontSize--; ctx.font = `${fontSize}px Noto`; } const lines = await wrapText(ctx, burn, 180); diff --git a/commands/edit-meme/two-buttons.js b/commands/edit-meme/two-buttons.js index ffc05a61..f6d9e093 100644 --- a/commands/edit-meme/two-buttons.js +++ b/commands/edit-meme/two-buttons.js @@ -60,7 +60,7 @@ module.exports = class TwoButtonsCommand extends Command { ctx.font = '34px Noto'; let fontSize = 34; while (ctx.measureText(first).width > 366) { - fontSize -= 1; + fontSize--; ctx.font = `${fontSize}px Noto`; } const firstLines = await wrapText(ctx, first, 183); @@ -72,7 +72,7 @@ module.exports = class TwoButtonsCommand extends Command { ctx.font = '34px Noto'; fontSize = 34; while (ctx.measureText(second).width > 244) { - fontSize -= 1; + fontSize--; ctx.font = `${fontSize}px Noto`; } const secondLines = await wrapText(ctx, second, 118); diff --git a/commands/games-mp/connect-four.js b/commands/games-mp/connect-four.js index 6e087979..e9e1ba3e 100644 --- a/commands/games-mp/connect-four.js +++ b/commands/games-mp/connect-four.js @@ -88,7 +88,7 @@ module.exports = class ConnectFourCommand extends Command { } const i = Number.parseInt(choice, 10) - 1; board[colLevels[i]][i] = sign; - colLevels[i] -= 1; + colLevels[i]--; if (this.verifyWin(board)) winner = userTurn ? msg.author : opponent; if (lastTurnTimeout) lastTurnTimeout = false; userTurn = !userTurn; diff --git a/commands/other/prune.js b/commands/other/prune.js index e4ac27fb..3a5df901 100644 --- a/commands/other/prune.js +++ b/commands/other/prune.js @@ -29,7 +29,7 @@ module.exports = class PruneCommand extends Command { } async run(msg, { count }) { - count += 1; + count++; try { const messages = await msg.channel.messages.fetch({ limit: count > 100 ? 100 : count }); await msg.channel.bulkDelete(messages, true); diff --git a/commands/random-res/lorem-ipsum.js b/commands/random-res/lorem-ipsum.js index 1bf980c7..4d7bd517 100644 --- a/commands/random-res/lorem-ipsum.js +++ b/commands/random-res/lorem-ipsum.js @@ -70,7 +70,7 @@ module.exports = class LoremIpsumCommand extends Command { resultLength += 2; } else { result.push(' '); - resultLength += 1; + resultLength++; } } return msg.say(result.join('')); diff --git a/commands/util/shutdown.js b/commands/util/shutdown.js index 84b58211..0a8f62ed 100644 --- a/commands/util/shutdown.js +++ b/commands/util/shutdown.js @@ -23,6 +23,8 @@ module.exports = class ShutdownCommand extends Command { } run(msg, { code }) { + this.uses++; + this.client.exportCommandLeaderboard(); this.client.logger.info('[SHUTDOWN] Manual shutdown engaged.'); process.exit(code); return null; diff --git a/package.json b/package.json index 4d91fe5d..55a2240c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "116.2.0", + "version": "116.2.1", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {