mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-06 14:20:51 +02:00
Fix
This commit is contained in:
@@ -44,6 +44,6 @@ module.exports = class ThreeThousandYearsCommand extends Command {
|
||||
ctx.drawImage(base, 0, 0);
|
||||
const { x, y, width, height } = centerImagePart(data, 200, 200, 461, 127);
|
||||
ctx.drawImage(data, x, y, width, height);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: '3000-years.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: '3000-years.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -52,6 +52,6 @@ module.exports = class AlertCommand extends Command {
|
||||
let text = wrapText(ctx, message, 540);
|
||||
text = text.length > 3 ? `${text.slice(0, 3).join('\n')}...` : text.join('\n');
|
||||
fillTextWithBreaks(ctx, text, 48, 178);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'alert.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'alert.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -53,6 +53,6 @@ module.exports = class LisaPresentationCommand extends Command {
|
||||
const arr = [];
|
||||
for (let i = 0; i < 12; i++) arr.push(shortened);
|
||||
fillTextWithBreaks(ctx, arr.join('\n'), 30, 27);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'bart-chalkboard.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'bart-chalkboard.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -51,6 +51,6 @@ module.exports = class BeLikeBillCommand extends Command {
|
||||
ctx.font = this.client.fonts.get('arialbd.ttf').toCanvasString(23);
|
||||
const text = wrapText(ctx, texts[Math.floor(Math.random() * texts.length)].replaceAll('{{name}}', name), 569);
|
||||
fillTextWithBreaks(ctx, `This is ${name}.\n\n${text.join('\n')}\n\n${name} is smart.\nBe like ${name}.`, 31, 80);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'be-like-bill.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'be-like-bill.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -52,6 +52,6 @@ module.exports = class BeautifulCommand extends Command {
|
||||
ctx.drawImage(avatar, 249, 24, 105, 105);
|
||||
ctx.drawImage(avatar, 249, 223, 105, 105);
|
||||
ctx.drawImage(base, 0, 0);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'beautiful.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'beautiful.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -70,6 +70,6 @@ module.exports = class BoardroomMeetingCommand extends Command {
|
||||
ctx.fillText(suggestion1, 30, 251, 90);
|
||||
ctx.fillText(suggestion2, 167, 258, 75);
|
||||
ctx.fillText(final, 310, 269, 130);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'boardroom-meeting.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'boardroom-meeting.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -55,6 +55,6 @@ module.exports = class CatchCommand extends Command {
|
||||
ctx.fillText(is.toUpperCase(), 163, 202);
|
||||
await msg.channel.send({ files: [path.join(__dirname, '..', '..', 'assets', 'images', 'catch', 'part-1.png')] });
|
||||
await delay(time * 1000);
|
||||
return msg.channel.send({ files: [{ attachment: canvas.toBuffer(), name: 'part-2.png' }] });
|
||||
return msg.channel.send({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'part-2.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -120,7 +120,7 @@ module.exports = class ChallengerCommand extends Command {
|
||||
const img = silhouetted ? this.silhouetteImage(data) : data;
|
||||
const { x, y, width, height } = centerImagePart(img, gameData.maxWidth, gameData.maxHeight, gameData.x, gameData.y);
|
||||
ctx.drawImage(img, x, y, width, height);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'challenger.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'challenger.png' }] });
|
||||
}
|
||||
|
||||
silhouetteImage(image) {
|
||||
|
||||
@@ -57,6 +57,6 @@ module.exports = class ChangeMyMindCommand extends Command {
|
||||
const lines = wrapText(ctx, text, 337);
|
||||
fillTextWithBreaks(ctx, lines.join('\n'), 142, 430, 337);
|
||||
ctx.rotate(24 * (Math.PI / 180));
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'change-my-mind.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'change-my-mind.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -65,6 +65,6 @@ module.exports = class ChiIdeaCommand extends Command {
|
||||
const height = topMost + ((fontSize + 5) * i);
|
||||
ctx.fillText(lines[i], 70, height);
|
||||
}
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'chi-idea.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'chi-idea.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -49,6 +49,6 @@ module.exports = class CrushCommand extends Command {
|
||||
ctx.drawImage(data, x, y, width, height);
|
||||
ctx.rotate(3.79 * (Math.PI / 180));
|
||||
ctx.drawImage(base, 0, 0);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'crush.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'crush.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -47,6 +47,6 @@ module.exports = class CursedSpongeCommand extends Command {
|
||||
if ((width + sponge.width) === (sponge.width * (rows > 1 ? 10 : amount))) width = 0;
|
||||
else width += sponge.width;
|
||||
}
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'cursed-sponge.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'cursed-sponge.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -73,6 +73,6 @@ module.exports = class DearLiberalsCommand extends Command {
|
||||
ctx.fillStyle = '#c31a41';
|
||||
const redLines = wrapText(ctx, redText, 165);
|
||||
fillTextWithBreaks(ctx, redLines.join('\n'), 326, 236);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'dear-liberals.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'dear-liberals.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -69,6 +69,6 @@ module.exports = class DemotivationalCommand extends Command {
|
||||
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(27);
|
||||
ctx.fillStyle = 'white';
|
||||
ctx.fillText(shortenText(ctx, text, 610), 375, 565);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'demotivational-poster.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'demotivational-poster.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -45,7 +45,7 @@ module.exports = class DislikeCommand extends Command {
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(base, 0, 0, plate.width, height);
|
||||
ctx.drawImage(plate, 0, height);
|
||||
const attachment = canvas.toBuffer();
|
||||
const attachment = canvas.toBuffer('image/png');
|
||||
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||
return msg.say({ files: [{ attachment, name: 'dislike.png' }] });
|
||||
}
|
||||
|
||||
@@ -64,6 +64,6 @@ module.exports = class DistractedBoyfriendCommand extends Command {
|
||||
ctx.drawImage(girlfriendAvatar, 539, 67, 100, 125);
|
||||
ctx.rotate(-3.11 * (Math.PI / 180));
|
||||
ctx.drawImage(otherGirlAvatar, 120, 96, 175, 175);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'distracted-boyfriend.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'distracted-boyfriend.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -77,6 +77,6 @@ module.exports = class DrakepostingCommand extends Command {
|
||||
const height = yeahTopMost + ((fontSize + 10) * i);
|
||||
ctx.fillText(yeahLines[i], 768, height);
|
||||
}
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'drakeposting.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'drakeposting.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -57,6 +57,6 @@ module.exports = class EddFactsBookCommand extends Command {
|
||||
const lines = wrapText(ctx, fact, 183);
|
||||
fillTextWithBreaks(ctx, lines.join('\n'), 119, 306, 183);
|
||||
ctx.rotate(-15 * (Math.PI / 180));
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'edd-facts-book.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'edd-facts-book.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -55,6 +55,6 @@ module.exports = class EnslavedCommand extends Command {
|
||||
ctx.fillStyle = 'white';
|
||||
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(50);
|
||||
ctx.fillText(name.toLowerCase(), 365, 400, 240);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'enslaved.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'enslaved.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -48,6 +48,6 @@ module.exports = class FoodBrokeCommand extends Command {
|
||||
contrast(ctx, 23, 9, 125, 125);
|
||||
ctx.drawImage(avatar, 117, 382, 75, 75);
|
||||
contrast(ctx, 117, 382, 75, 75);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'food-broke.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'food-broke.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -45,7 +45,7 @@ module.exports = class ForFiveHoursCommand extends Command {
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(base, 0, 0, plate.width, height);
|
||||
ctx.drawImage(plate, 0, height + 1);
|
||||
const attachment = canvas.toBuffer();
|
||||
const attachment = canvas.toBuffer('image/png');
|
||||
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||
return msg.say({ files: [{ attachment, name: 'for-five-hours.png' }] });
|
||||
}
|
||||
|
||||
@@ -61,6 +61,6 @@ module.exports = class GenieRulesCommand extends Command {
|
||||
const height = topMost + ((fontSize + 20) * i);
|
||||
ctx.fillText(lines[i], 220, height);
|
||||
}
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'genie-rules.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'genie-rules.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -51,6 +51,6 @@ module.exports = class GirlWorthFightingForCommand extends Command {
|
||||
ctx.drawImage(base, 0, 0);
|
||||
const { x, y, width, height } = centerImagePart(data, 150, 150, 380, 511);
|
||||
ctx.drawImage(data, x, y, width, height);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'girl-worth-fighting-for.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'girl-worth-fighting-for.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -76,6 +76,6 @@ module.exports = class GruPlanCommand extends Command {
|
||||
fillTextWithBreaks(ctx, lines.join('\n'), x, y);
|
||||
i++;
|
||||
}
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'gru-plan.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'gru-plan.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -54,6 +54,6 @@ module.exports = class ICantBelieveCommand extends Command {
|
||||
ctx.fillStyle = '#13487b';
|
||||
ctx.fillText(firstUpperCase(text.toLowerCase(), null), 13, 54, 171);
|
||||
ctx.rotate(8 * (Math.PI / 180));
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'i-cant-believe.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'i-cant-believe.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -45,6 +45,6 @@ module.exports = class IFearNoManCommand extends Command {
|
||||
ctx.drawImage(base, 0, 0);
|
||||
const { x, y, width, height } = centerImagePart(data, 169, 169, 167, 330);
|
||||
ctx.drawImage(data, x, y, width, height);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'i-fear-no-man.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'i-fear-no-man.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -59,6 +59,6 @@ module.exports = class IfThoseKidsCouldReadCommand extends Command {
|
||||
const height = topMost + ((fontSize + 20) * i);
|
||||
ctx.fillText(lines[i], 300, height);
|
||||
}
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'if-those-kids-could-read.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'if-those-kids-could-read.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -52,6 +52,6 @@ module.exports = class KyonGunCommand extends Command {
|
||||
const width = Math.round(base.height * ratio);
|
||||
ctx.drawImage(data, (base.width / 2) - (width / 2), 0, width, base.height);
|
||||
ctx.drawImage(base, 0, 0);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'kyon-gun.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'kyon-gun.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -45,7 +45,7 @@ module.exports = class LikeCommand extends Command {
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(base, 0, 0, plate.width, height);
|
||||
ctx.drawImage(plate, 0, height);
|
||||
const attachment = canvas.toBuffer();
|
||||
const attachment = canvas.toBuffer('image/png');
|
||||
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||
return msg.say({ files: [{ attachment, name: 'like.png' }] });
|
||||
}
|
||||
|
||||
@@ -60,6 +60,6 @@ module.exports = class LisaPresentationCommand extends Command {
|
||||
const height = topMost + ((fontSize + 20) * i);
|
||||
ctx.fillText(lines[i], base.width / 2, height);
|
||||
}
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'lisa-presentation.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'lisa-presentation.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -45,6 +45,6 @@ module.exports = class LookAtThisPhotographCommand extends Command {
|
||||
ctx.rotate(-13.5 * (Math.PI / 180));
|
||||
ctx.drawImage(data, 280, 218, 175, 125);
|
||||
ctx.rotate(13.5 * (Math.PI / 180));
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'look-at-this-photograph.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'look-at-this-photograph.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -54,6 +54,6 @@ module.exports = class LookWhatKarenHaveCommand extends Command {
|
||||
ctx.drawImage(data, x, y, width, height);
|
||||
ctx.rotate(6.5 * (Math.PI / 180));
|
||||
ctx.drawImage(base, 0, 0);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'look-what-karen-have.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'look-what-karen-have.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -91,6 +91,6 @@ module.exports = class MarioBrosViewsCommand extends Command {
|
||||
ctx.strokeText(luigiLines[i], 450, height);
|
||||
ctx.fillText(luigiLines[i], 450, height);
|
||||
}
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'mario-bros-views.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'mario-bros-views.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -80,7 +80,7 @@ module.exports = class MemeGenCommand extends Command {
|
||||
ctx.fillStyle = 'white';
|
||||
ctx.fillText(bottomLines[i], base.width / 2, textHeight);
|
||||
}
|
||||
const attachment = canvas.toBuffer();
|
||||
const attachment = canvas.toBuffer('image/png');
|
||||
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||
return msg.say({ files: [{ attachment, name: 'meme-gen.png' }] });
|
||||
}
|
||||
|
||||
@@ -59,6 +59,6 @@ module.exports = class MetamorphosisCommand extends Command {
|
||||
ctx.textBaseline = 'top';
|
||||
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(20);
|
||||
ctx.fillText(`le ${name.toLowerCase()}`, 345, 466, 330);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'metamorphosis.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'metamorphosis.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -49,6 +49,6 @@ module.exports = class MyCollectionGrowsCommand extends Command {
|
||||
ctx.drawImage(data, x, y, width, height);
|
||||
ctx.rotate(14 * (Math.PI / 180));
|
||||
ctx.drawImage(base, 0, 0);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'my-collection-grows.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'my-collection-grows.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -48,6 +48,6 @@ module.exports = class NewPasswordCommand extends Command {
|
||||
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(60);
|
||||
ctx.fillText(shortenText(ctx, weak, 780), 70, 191);
|
||||
ctx.fillText(shortenText(ctx, strong, 780), 70, 667);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'new-password.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'new-password.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -74,7 +74,7 @@ module.exports = class NikeAdCommand extends Command {
|
||||
const textHeight = initial + (i * fontSize) + (i * 10);
|
||||
ctx.fillText(lines[i], data.width / 2, textHeight);
|
||||
}
|
||||
const attachment = canvas.toBuffer();
|
||||
const attachment = canvas.toBuffer('image/png');
|
||||
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||
return msg.say({ files: [{ attachment, name: 'nike-ad.png' }] });
|
||||
}
|
||||
|
||||
@@ -89,6 +89,6 @@ module.exports = class PanikKalmPanikCommand extends Command {
|
||||
const height = panik2TopMost + ((fontSize + 10) * i);
|
||||
ctx.fillText(panik2Lines[i], 150, height);
|
||||
}
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'panik-kalm-panik.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'panik-kalm-panik.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -92,6 +92,6 @@ module.exports = class PhoebeTeachingJoeyCommand extends Command {
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'phoebe-teaching-joey.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'phoebe-teaching-joey.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -57,6 +57,6 @@ module.exports = class PillsCommand extends Command {
|
||||
ctx.strokeText(lines[i], 183, height);
|
||||
ctx.fillText(lines[i], 183, height);
|
||||
}
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'pills.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'pills.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -76,6 +76,6 @@ module.exports = class PlanktonPlanCommand extends Command {
|
||||
fillTextWithBreaks(ctx, lines.join('\n'), x, y);
|
||||
i++;
|
||||
}
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'plankton-plan.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'plankton-plan.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -44,6 +44,6 @@ module.exports = class RawCommand extends Command {
|
||||
ctx.textBaseline = 'top';
|
||||
ctx.font = this.client.fonts.get('wildwordsroman.ttf').toCanvasString(23);
|
||||
ctx.fillText(text, 520, 143, 165);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'raw.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'raw.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -60,7 +60,7 @@ module.exports = class ReactionMemeCommand extends Command {
|
||||
ctx.fillStyle = 'black';
|
||||
fillTextWithBreaks(ctx, lines.join('\n'), 5, 5);
|
||||
ctx.drawImage(base, 0, linesLen);
|
||||
const attachment = canvas.toBuffer();
|
||||
const attachment = canvas.toBuffer('image/png');
|
||||
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||
return msg.say({ files: [{ attachment, name: 'meme-gen-modern.png' }] });
|
||||
}
|
||||
|
||||
@@ -60,6 +60,6 @@ module.exports = class ScrollOfTruthCommand extends Command {
|
||||
const height = topMost + ((fontSize + 20) * i);
|
||||
ctx.fillText(lines[i], 350, height);
|
||||
}
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'scroll-of-truth.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'scroll-of-truth.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -42,7 +42,7 @@ module.exports = class SexySinglesCommand extends Command {
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(base, plate.width, 0, width, plate.height);
|
||||
ctx.drawImage(plate, 0, 0);
|
||||
const attachment = canvas.toBuffer();
|
||||
const attachment = canvas.toBuffer('image/png');
|
||||
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||
return msg.say({ files: [{ attachment, name: 'sexy-singles.png' }] });
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ module.exports = class SkyrimSkillCommand extends Command {
|
||||
ctx.fillText(skill, 189 + 5, height + 75 + 3, 300);
|
||||
ctx.fillStyle = 'white';
|
||||
ctx.fillText(skill, 189, height + 75, 300);
|
||||
const attachment = canvas.toBuffer();
|
||||
const attachment = canvas.toBuffer('image/png');
|
||||
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||
return msg.say({ files: [{ attachment, name: 'skyrim-skill.png' }] });
|
||||
}
|
||||
|
||||
@@ -56,6 +56,6 @@ module.exports = class SonicSaysCommand extends Command {
|
||||
const lines = wrapText(ctx, text, 185);
|
||||
ctx.fillStyle = 'white';
|
||||
fillTextWithBreaks(ctx, lines.join('\n'), 92, 67, 185);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'sonic-says.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'sonic-says.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -53,6 +53,6 @@ module.exports = class SoraSelfieCommand extends Command {
|
||||
const width = Math.round(base.height * ratio);
|
||||
ctx.drawImage(data, (base.width / 2) - (width / 2), 0, width, base.height);
|
||||
ctx.drawImage(base, 0, 0);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'sora-selfie.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'sora-selfie.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -56,6 +56,6 @@ module.exports = class SosCommand extends Command {
|
||||
}
|
||||
ctx.fillText(message.toUpperCase(), 362, 522);
|
||||
ctx.rotate(-15 * (Math.PI / 180));
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'sos.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'sos.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -84,6 +84,6 @@ module.exports = class SpidermanPointingCommand extends Command {
|
||||
ctx.strokeText(lines2[i], 596, height);
|
||||
ctx.fillText(lines2[i], 596, height);
|
||||
}
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'spiderman-pointing.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'spiderman-pointing.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -67,6 +67,6 @@ module.exports = class SpongebobBurnCommand extends Command {
|
||||
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(20);
|
||||
ctx.fillText(person, 119, 405);
|
||||
ctx.fillText(person, 439, 434);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'spongebob-burn.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'spongebob-burn.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -72,6 +72,6 @@ module.exports = class ThatSignWontStopMeCommand extends Command {
|
||||
const height = bTopMost + ((fontSize + 2) * i);
|
||||
ctx.fillText(bLines[i], 280, height);
|
||||
}
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'that-sign-wont-stop-me.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'that-sign-wont-stop-me.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -45,6 +45,6 @@ module.exports = class ThisGuyCommand extends Command {
|
||||
ctx.drawImage(base, 0, 0);
|
||||
const { x, y, width, height } = centerImagePart(data, 361, 361, 76, 62);
|
||||
ctx.drawImage(data, x, y, width, height);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'this-guy.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'this-guy.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -48,7 +48,7 @@ module.exports = class ThugLifeCommand extends Command {
|
||||
const width = data.width / 2;
|
||||
const height = Math.round(width / ratio);
|
||||
ctx.drawImage(base, (data.width / 2) - (width / 2), data.height - height, width, height);
|
||||
const attachment = canvas.toBuffer();
|
||||
const attachment = canvas.toBuffer('image/png');
|
||||
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||
return msg.say({ files: [{ attachment, name: 'thug-life.png' }] });
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ module.exports = class ToBeContinuedCommand extends Command {
|
||||
const width = canvas.width / 2;
|
||||
const height = Math.round(width / ratio);
|
||||
ctx.drawImage(base, 0, canvas.height - height, width, height);
|
||||
const attachment = canvas.toBuffer();
|
||||
const attachment = canvas.toBuffer('image/png');
|
||||
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||
return msg.say({ files: [{ attachment, name: 'to-be-continued.png' }] });
|
||||
}
|
||||
|
||||
@@ -77,6 +77,6 @@ module.exports = class TuxedoPoohCommand extends Command {
|
||||
const height = tuxedoTopMost + ((fontSize + 10) * i);
|
||||
ctx.fillText(tuxedoLines[i], 570, height);
|
||||
}
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'tuxedo-pooh.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'tuxedo-pooh.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -78,6 +78,6 @@ module.exports = class TwoButtonsCommand extends Command {
|
||||
lineOffset += 5;
|
||||
}
|
||||
ctx.rotate(12 * (Math.PI / 180));
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'two-buttons.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'two-buttons.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -45,6 +45,6 @@ module.exports = class UglyCommand extends Command {
|
||||
const { x, y, width, height } = centerImagePart(data, 170, 170, 120, 52);
|
||||
ctx.drawImage(data, x, y, width, height);
|
||||
ctx.drawImage(base, 0, 0);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'ugly.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'ugly.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -47,6 +47,6 @@ module.exports = class UltimateTattooCommand extends Command {
|
||||
const { x, y, width, height } = centerImagePart(data, 300, 300, 84, 690);
|
||||
ctx.drawImage(data, x, y, width, height);
|
||||
ctx.rotate(10 * (Math.PI / 180));
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'ultimate-tattoo.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'ultimate-tattoo.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -45,7 +45,7 @@ module.exports = class VietnamFlashbacksCommand extends Command {
|
||||
ctx.drawImage(base, (data.width / 2) - (width / 2), 0, width, data.height);
|
||||
ctx.globalAlpha = 0.675;
|
||||
ctx.drawImage(data, 0, 0);
|
||||
const attachment = canvas.toBuffer();
|
||||
const attachment = canvas.toBuffer('image/png');
|
||||
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||
return msg.say({ files: [{ attachment, name: 'vietnam-flashbacks.png' }] });
|
||||
}
|
||||
|
||||
@@ -76,6 +76,6 @@ module.exports = class WhiteboardCommand extends Command {
|
||||
const height = resolveTopMost + ((fontSize + 10) * i);
|
||||
ctx.fillText(resolveLines[i], 195, height);
|
||||
}
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'whiteboard.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'whiteboard.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -44,6 +44,6 @@ module.exports = class WorseThanHitlerCommand extends Command {
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(base, 0, 0);
|
||||
ctx.drawImage(avatar, 47, 42, 140, 140);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'worse-than-hitler.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'worse-than-hitler.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -53,6 +53,6 @@ module.exports = class WorthlessCommand extends Command {
|
||||
const center2 = centerImagePart(data, 75, 75, 625, 55);
|
||||
ctx.drawImage(data, center2.x, center2.y, center2.width, center2.height);
|
||||
ctx.rotate(-160 * (Math.PI / 180));
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'worthless.png' }] });
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'worthless.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user