mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Export command leaderboard on shutdown command
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -70,7 +70,7 @@ module.exports = class LoremIpsumCommand extends Command {
|
||||
resultLength += 2;
|
||||
} else {
|
||||
result.push(' ');
|
||||
resultLength += 1;
|
||||
resultLength++;
|
||||
}
|
||||
}
|
||||
return msg.say(result.join(''));
|
||||
|
||||
@@ -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;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "116.2.0",
|
||||
"version": "116.2.1",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user