Export command leaderboard on shutdown command

This commit is contained in:
Dragon Fire
2020-06-07 08:54:04 -04:00
parent a908a671d0
commit c0cda06749
17 changed files with 19 additions and 17 deletions
+1 -1
View File
@@ -58,7 +58,7 @@ module.exports = class ChiIdeaCommand extends Command {
ctx.font = '15px Wild Words'; ctx.font = '15px Wild Words';
let fontSize = 15; let fontSize = 15;
while (ctx.measureText(text).width > 500) { while (ctx.measureText(text).width > 500) {
fontSize -= 1; fontSize--;
ctx.font = `${fontSize}px Wild Words`; ctx.font = `${fontSize}px Wild Words`;
} }
const lines = await wrapText(ctx, text, 83); const lines = await wrapText(ctx, text, 83);
+1 -1
View File
@@ -54,7 +54,7 @@ module.exports = class EddFactsBookCommand extends Command {
ctx.font = '30px Noto'; ctx.font = '30px Noto';
let fontSize = 30; let fontSize = 30;
while (ctx.measureText(fact).width > 458) { while (ctx.measureText(fact).width > 458) {
fontSize -= 1; fontSize--;
ctx.font = `${fontSize}px Noto`; ctx.font = `${fontSize}px Noto`;
} }
const lines = await wrapText(ctx, fact, 183); const lines = await wrapText(ctx, fact, 183);
+1 -1
View File
@@ -55,7 +55,7 @@ module.exports = class GenieRulesCommand extends Command {
ctx.font = '40px Noto'; ctx.font = '40px Noto';
let fontSize = 40; let fontSize = 40;
while (ctx.measureText(text).width > 1143) { while (ctx.measureText(text).width > 1143) {
fontSize -= 1; fontSize--;
ctx.font = `${fontSize}px Noto`; ctx.font = `${fontSize}px Noto`;
} }
const lines = await wrapText(ctx, text, 381); const lines = await wrapText(ctx, text, 381);
+1 -1
View File
@@ -74,7 +74,7 @@ module.exports = class GruPlanCommand extends Command {
const step = steps[i]; const step = steps[i];
let fontSize = 35; let fontSize = 35;
while (ctx.measureText(step).width > 1100) { while (ctx.measureText(step).width > 1100) {
fontSize -= 1; fontSize--;
ctx.font = `${fontSize}px Noto`; ctx.font = `${fontSize}px Noto`;
} }
const lines = await wrapText(ctx, step, 252); const lines = await wrapText(ctx, step, 252);
+1 -1
View File
@@ -62,7 +62,7 @@ module.exports = class IllegalCommand extends Command {
let fontSize = 45; let fontSize = 45;
ctx.font = `${fontSize}px Noto`; ctx.font = `${fontSize}px Noto`;
while (ctx.measureText(illegalText).width > 550) { while (ctx.measureText(illegalText).width > 550) {
fontSize -= 1; fontSize--;
ctx.font = `${fontSize}px Noto`; ctx.font = `${fontSize}px Noto`;
} }
const lines = await wrapText(ctx, illegalText, 200); const lines = await wrapText(ctx, illegalText, 200);
+1 -1
View File
@@ -54,7 +54,7 @@ module.exports = class LisaPresentationCommand extends Command {
ctx.font = '40px Noto'; ctx.font = '40px Noto';
let fontSize = 40; let fontSize = 40;
while (ctx.measureText(text).width > 1320) { while (ctx.measureText(text).width > 1320) {
fontSize -= 1; fontSize--;
ctx.font = `${fontSize}px Noto`; ctx.font = `${fontSize}px Noto`;
} }
const lines = await wrapText(ctx, text, 330); const lines = await wrapText(ctx, text, 330);
+1 -1
View File
@@ -87,7 +87,7 @@ module.exports = class PhoebeTeachingJoeyCommand extends Command {
if (step === incorrect && j === 0) step = correct.join(' '); if (step === incorrect && j === 0) step = correct.join(' ');
let fontSize = 20; let fontSize = 20;
while (ctx.measureText(step).width > 260) { while (ctx.measureText(step).width > 260) {
fontSize -= 1; fontSize--;
ctx.font = `${fontSize}px Noto`; ctx.font = `${fontSize}px Noto`;
} }
ctx.strokeText(step, x, y, 260); ctx.strokeText(step, x, y, 260);
+1 -1
View File
@@ -74,7 +74,7 @@ module.exports = class PlanktonPlanCommand extends Command {
const step = steps[i]; const step = steps[i];
let fontSize = 35; let fontSize = 35;
while (ctx.measureText(step).width > 420) { while (ctx.measureText(step).width > 420) {
fontSize -= 1; fontSize--;
ctx.font = `${fontSize}px Noto`; ctx.font = `${fontSize}px Noto`;
} }
const lines = await wrapText(ctx, step, 155); const lines = await wrapText(ctx, step, 155);
+1 -1
View File
@@ -54,7 +54,7 @@ module.exports = class ScrollOfTruthCommand extends Command {
ctx.font = '60px Noto'; ctx.font = '60px Noto';
let fontSize = 60; let fontSize = 60;
while (ctx.measureText(text).width > 542) { while (ctx.measureText(text).width > 542) {
fontSize -= 1; fontSize--;
ctx.font = `${fontSize}px Noto`; ctx.font = `${fontSize}px Noto`;
} }
const lines = await wrapText(ctx, text, 217); const lines = await wrapText(ctx, text, 217);
+1 -1
View File
@@ -54,7 +54,7 @@ module.exports = class SosCommand extends Command {
ctx.rotate(15 * (Math.PI / 180)); ctx.rotate(15 * (Math.PI / 180));
let fontSize = 90; let fontSize = 90;
while (ctx.measureText(message).width > 140) { while (ctx.measureText(message).width > 140) {
fontSize -= 1; fontSize--;
ctx.font = `${fontSize}px Noto`; ctx.font = `${fontSize}px Noto`;
} }
ctx.fillText(message.toUpperCase(), 362, 522); ctx.fillText(message.toUpperCase(), 362, 522);
+1 -1
View File
@@ -61,7 +61,7 @@ module.exports = class SpongebobBurnCommand extends Command {
ctx.font = '35px Noto'; ctx.font = '35px Noto';
let fontSize = 35; let fontSize = 35;
while (ctx.measureText(burn).width > 400) { while (ctx.measureText(burn).width > 400) {
fontSize -= 1; fontSize--;
ctx.font = `${fontSize}px Noto`; ctx.font = `${fontSize}px Noto`;
} }
const lines = await wrapText(ctx, burn, 180); const lines = await wrapText(ctx, burn, 180);
+2 -2
View File
@@ -60,7 +60,7 @@ module.exports = class TwoButtonsCommand extends Command {
ctx.font = '34px Noto'; ctx.font = '34px Noto';
let fontSize = 34; let fontSize = 34;
while (ctx.measureText(first).width > 366) { while (ctx.measureText(first).width > 366) {
fontSize -= 1; fontSize--;
ctx.font = `${fontSize}px Noto`; ctx.font = `${fontSize}px Noto`;
} }
const firstLines = await wrapText(ctx, first, 183); const firstLines = await wrapText(ctx, first, 183);
@@ -72,7 +72,7 @@ module.exports = class TwoButtonsCommand extends Command {
ctx.font = '34px Noto'; ctx.font = '34px Noto';
fontSize = 34; fontSize = 34;
while (ctx.measureText(second).width > 244) { while (ctx.measureText(second).width > 244) {
fontSize -= 1; fontSize--;
ctx.font = `${fontSize}px Noto`; ctx.font = `${fontSize}px Noto`;
} }
const secondLines = await wrapText(ctx, second, 118); const secondLines = await wrapText(ctx, second, 118);
+1 -1
View File
@@ -88,7 +88,7 @@ module.exports = class ConnectFourCommand extends Command {
} }
const i = Number.parseInt(choice, 10) - 1; const i = Number.parseInt(choice, 10) - 1;
board[colLevels[i]][i] = sign; board[colLevels[i]][i] = sign;
colLevels[i] -= 1; colLevels[i]--;
if (this.verifyWin(board)) winner = userTurn ? msg.author : opponent; if (this.verifyWin(board)) winner = userTurn ? msg.author : opponent;
if (lastTurnTimeout) lastTurnTimeout = false; if (lastTurnTimeout) lastTurnTimeout = false;
userTurn = !userTurn; userTurn = !userTurn;
+1 -1
View File
@@ -29,7 +29,7 @@ module.exports = class PruneCommand extends Command {
} }
async run(msg, { count }) { async run(msg, { count }) {
count += 1; count++;
try { try {
const messages = await msg.channel.messages.fetch({ limit: count > 100 ? 100 : count }); const messages = await msg.channel.messages.fetch({ limit: count > 100 ? 100 : count });
await msg.channel.bulkDelete(messages, true); await msg.channel.bulkDelete(messages, true);
+1 -1
View File
@@ -70,7 +70,7 @@ module.exports = class LoremIpsumCommand extends Command {
resultLength += 2; resultLength += 2;
} else { } else {
result.push(' '); result.push(' ');
resultLength += 1; resultLength++;
} }
} }
return msg.say(result.join('')); return msg.say(result.join(''));
+2
View File
@@ -23,6 +23,8 @@ module.exports = class ShutdownCommand extends Command {
} }
run(msg, { code }) { run(msg, { code }) {
this.uses++;
this.client.exportCommandLeaderboard();
this.client.logger.info('[SHUTDOWN] Manual shutdown engaged.'); this.client.logger.info('[SHUTDOWN] Manual shutdown engaged.');
process.exit(code); process.exit(code);
return null; return null;
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "xiao", "name": "xiao",
"version": "116.2.0", "version": "116.2.1",
"description": "Your personal server companion.", "description": "Your personal server companion.",
"main": "Xiao.js", "main": "Xiao.js",
"scripts": { "scripts": {