mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Fix
This commit is contained in:
@@ -37,7 +37,7 @@ module.exports = class DominantColorCommand extends Command {
|
|||||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||||
const name = ntc.name(hexColor);
|
const name = ntc.name(hexColor);
|
||||||
return msg.say(`${hexColor.toUpperCase()} - ${name[1]}`, {
|
return msg.say(`${hexColor.toUpperCase()} - ${name[1]}`, {
|
||||||
files: [{ attachment: canvas.toBuffer(), name: 'dominant-color.png' }]
|
files: [{ attachment: canvas.toBuffer('image/png'), name: 'dominant-color.png' }]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -40,6 +40,6 @@ module.exports = class FacesCommand extends Command {
|
|||||||
ctx.fillRect(face.box.xMin, face.box.yMax, face.box.width + lineSize, lineSize);
|
ctx.fillRect(face.box.xMin, face.box.yMax, face.box.width + lineSize, lineSize);
|
||||||
ctx.fillRect(face.box.xMax, face.box.yMin, lineSize, face.box.height);
|
ctx.fillRect(face.box.xMax, face.box.yMin, lineSize, face.box.height);
|
||||||
}
|
}
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'faces.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'faces.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -42,6 +42,6 @@ module.exports = class AvatarFusionCommand extends Command {
|
|||||||
ctx.globalAlpha = 0.5;
|
ctx.globalAlpha = 0.5;
|
||||||
ctx.drawImage(baseAvatar, 0, 0);
|
ctx.drawImage(baseAvatar, 0, 0);
|
||||||
ctx.drawImage(overlayAvatar, 0, 0, baseAvatar.width, baseAvatar.height);
|
ctx.drawImage(overlayAvatar, 0, 0, baseAvatar.width, baseAvatar.height);
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'avatar-fusion.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'avatar-fusion.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -154,6 +154,6 @@ module.exports = class HatCommand extends Command {
|
|||||||
ctx.drawImage(avatar, 0, 0);
|
ctx.drawImage(avatar, 0, 0);
|
||||||
ctx.drawImage(base, 0, 0, avatar.width, avatar.height);
|
ctx.drawImage(base, 0, 0, avatar.width, avatar.height);
|
||||||
const comment = user.id === this.client.user.id ? hat.commentMe : hat.comment.replace(/{{user}}/g, user.tag);
|
const comment = user.id === this.client.user.id ? hat.commentMe : hat.comment.replace(/{{user}}/g, user.tag);
|
||||||
return msg.say(comment, { files: [{ attachment: canvas.toBuffer(), name: `${type}-hat.png` }] });
|
return msg.say(comment, { files: [{ attachment: canvas.toBuffer('image/png'), name: `${type}-hat.png` }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -47,6 +47,6 @@ module.exports = class HeLivesInYouCommand extends Command {
|
|||||||
ctx.rotate(-24 * (Math.PI / 180));
|
ctx.rotate(-24 * (Math.PI / 180));
|
||||||
drawImageWithTint(ctx, avatar, '#00115d', 75, 160, 130, 150);
|
drawImageWithTint(ctx, avatar, '#00115d', 75, 160, 130, 150);
|
||||||
ctx.rotate(24 * (Math.PI / 180));
|
ctx.rotate(24 * (Math.PI / 180));
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'he-lives-in-you.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'he-lives-in-you.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -45,6 +45,6 @@ module.exports = class HeartsCommand extends Command {
|
|||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
drawImageWithTint(ctx, avatar, 'deeppink', 0, 0, avatar.width, avatar.height);
|
drawImageWithTint(ctx, avatar, 'deeppink', 0, 0, avatar.width, avatar.height);
|
||||||
ctx.drawImage(base, 0, 0, avatar.width, avatar.height);
|
ctx.drawImage(base, 0, 0, avatar.width, avatar.height);
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'hearts.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'hearts.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -45,6 +45,6 @@ module.exports = class IHaveThePowerCommand extends Command {
|
|||||||
ctx.rotate(18.3 * (Math.PI / 180));
|
ctx.rotate(18.3 * (Math.PI / 180));
|
||||||
ctx.drawImage(avatar, 332, -125, 175, 175);
|
ctx.drawImage(avatar, 332, -125, 175, 175);
|
||||||
ctx.rotate(-18.3 * (Math.PI / 180));
|
ctx.rotate(-18.3 * (Math.PI / 180));
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'i-have-the-power.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'i-have-the-power.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -67,6 +67,6 @@ module.exports = class RipCommand extends Command {
|
|||||||
if (cause) ctx.fillText(cause, 438, 910, 500);
|
if (cause) ctx.fillText(cause, 438, 910, 500);
|
||||||
ctx.font = this.client.fonts.get('CoffinStone.otf').toCanvasString(37);
|
ctx.font = this.client.fonts.get('CoffinStone.otf').toCanvasString(37);
|
||||||
ctx.fillText('In Loving Memory of', 438, 292);
|
ctx.fillText('In Loving Memory of', 438, 292);
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'rip.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'rip.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -58,6 +58,6 @@ module.exports = class SteamNowPlayingCommand extends Command {
|
|||||||
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(14);
|
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(14);
|
||||||
ctx.fillText(user.username, 80, 34);
|
ctx.fillText(user.username, 80, 34);
|
||||||
ctx.fillText(shortenText(ctx, game, 200), 80, 70);
|
ctx.fillText(shortenText(ctx, game, 200), 80, 70);
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'steam-now-playing.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'steam-now-playing.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -47,6 +47,6 @@ module.exports = class AnimeEyesCommand extends Command {
|
|||||||
ctx.drawImage(rightEye, leftEyeX, leftEyeY, eyeWidth, eyeHeight);
|
ctx.drawImage(rightEye, leftEyeX, leftEyeY, eyeWidth, eyeHeight);
|
||||||
ctx.drawImage(leftEye, rightEyeX, rightEyeY, eyeWidth, eyeHeight);
|
ctx.drawImage(leftEye, rightEyeX, rightEyeY, eyeWidth, eyeHeight);
|
||||||
}
|
}
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'anime-eyes.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'anime-eyes.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -52,6 +52,6 @@ module.exports = class DannyDevitoCommand extends Command {
|
|||||||
height * 1.4
|
height * 1.4
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'danny-devito.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'danny-devito.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -63,6 +63,6 @@ module.exports = class EmojiFaceCommand extends Command {
|
|||||||
height * 1.4
|
height * 1.4
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'emoji-face.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'emoji-face.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -45,6 +45,6 @@ module.exports = class EyesCommand extends Command {
|
|||||||
ctx.drawImage(eyes, leftEyeX, leftEyeY, eyeWidth, eyeHeight);
|
ctx.drawImage(eyes, leftEyeX, leftEyeY, eyeWidth, eyeHeight);
|
||||||
ctx.drawImage(eyes, rightEyeX, rightEyeY, eyeWidth, eyeHeight);
|
ctx.drawImage(eyes, rightEyeX, rightEyeY, eyeWidth, eyeHeight);
|
||||||
}
|
}
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'eyes.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'eyes.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -52,6 +52,6 @@ module.exports = class ShrekCommand extends Command {
|
|||||||
height * 1.5
|
height * 1.5
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'shrek.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'shrek.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -83,6 +83,6 @@ module.exports = class AceAttorneyCommand extends Command {
|
|||||||
let text = wrapText(ctx, quote, 242);
|
let text = wrapText(ctx, quote, 242);
|
||||||
text = text.length > 5 ? `${text.slice(0, 5).join('\n')}...` : text.join('\n');
|
text = text.length > 5 ? `${text.slice(0, 5).join('\n')}...` : text.join('\n');
|
||||||
fillTextWithBreaks(ctx, text, 7, 199);
|
fillTextWithBreaks(ctx, text, 7, 199);
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: `ace-attorney-${character}.png` }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: `ace-attorney-${character}.png` }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -56,6 +56,6 @@ module.exports = class AchievementCommand extends Command {
|
|||||||
ctx.fillText('Achievement Get!', 60, 40);
|
ctx.fillText('Achievement Get!', 60, 40);
|
||||||
ctx.fillStyle = '#ffffff';
|
ctx.fillStyle = '#ffffff';
|
||||||
ctx.fillText(shortenText(ctx, text, 230), 60, 60);
|
ctx.fillText(shortenText(ctx, text, 230), 60, 60);
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'achievement.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'achievement.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -60,6 +60,6 @@ module.exports = class CautionCommand extends Command {
|
|||||||
const height = topMost + ((fontSize + 20) * i);
|
const height = topMost + ((fontSize + 20) * i);
|
||||||
ctx.fillText(lines[i], base.width / 2, height);
|
ctx.fillText(lines[i], base.width / 2, height);
|
||||||
}
|
}
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'caution.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'caution.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -63,6 +63,6 @@ module.exports = class CertificateCommand extends Command {
|
|||||||
ctx.fillText(reason, 518, 273);
|
ctx.fillText(reason, 518, 273);
|
||||||
ctx.fillText(name, 518, 419);
|
ctx.fillText(name, 518, 419);
|
||||||
ctx.fillText(moment().format('MM/DD/YYYY'), 309, 503);
|
ctx.fillText(moment().format('MM/DD/YYYY'), 309, 503);
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'certificate.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'certificate.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -65,6 +65,6 @@ module.exports = class ChineseRestaurantCommand extends Command {
|
|||||||
ctx.fillText(lines[2], base.width / 2, 315);
|
ctx.fillText(lines[2], base.width / 2, 315);
|
||||||
ctx.fillText(lines[3], base.width / 2, 342);
|
ctx.fillText(lines[3], base.width / 2, 342);
|
||||||
}
|
}
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'chinese-restaurant.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'chinese-restaurant.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -60,6 +60,6 @@ module.exports = class DangerCommand extends Command {
|
|||||||
const height = topMost + ((fontSize + 20) * i);
|
const height = topMost + ((fontSize + 20) * i);
|
||||||
ctx.fillText(lines[i], base.width / 2, height);
|
ctx.fillText(lines[i], base.width / 2, height);
|
||||||
}
|
}
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'danger.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'danger.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -47,6 +47,6 @@ module.exports = class FontCommand extends Command {
|
|||||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||||
ctx.fillStyle = 'black';
|
ctx.fillStyle = 'black';
|
||||||
fillTextWithBreaks(ctx, lines.join('\n'), 25, 25);
|
fillTextWithBreaks(ctx, lines.join('\n'), 25, 25);
|
||||||
return canvas.toBuffer();
|
return canvas.toBuffer('image/png');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -55,6 +55,6 @@ module.exports = class GandhiQuoteCommand extends Command {
|
|||||||
const height = topMost + ((fontSize + 20) * i);
|
const height = topMost + ((fontSize + 20) * i);
|
||||||
ctx.fillText(lines[i], 395, height);
|
ctx.fillText(lines[i], 395, height);
|
||||||
}
|
}
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'gandhi-quote.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'gandhi-quote.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -65,6 +65,6 @@ module.exports = class HighwaySignCommand extends Command {
|
|||||||
ctx.fillText(lines[2], 318, 128);
|
ctx.fillText(lines[2], 318, 128);
|
||||||
ctx.fillText(lines[3], 318, 147);
|
ctx.fillText(lines[3], 318, 147);
|
||||||
}
|
}
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'highway-sign.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'highway-sign.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -55,6 +55,6 @@ module.exports = class HollywoodStarCommand extends Command {
|
|||||||
ctx.textAlign = 'center';
|
ctx.textAlign = 'center';
|
||||||
ctx.textBaseline = 'top';
|
ctx.textBaseline = 'top';
|
||||||
ctx.fillText(name.toLowerCase(), 288, 140);
|
ctx.fillText(name.toLowerCase(), 288, 140);
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'hollywood-star.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'hollywood-star.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -57,6 +57,6 @@ module.exports = class JeopardyQuestionCommand extends Command {
|
|||||||
ctx.fillStyle = 'white';
|
ctx.fillStyle = 'white';
|
||||||
ctx.fillText(lines[i], canvas.width / 2, height);
|
ctx.fillText(lines[i], canvas.width / 2, height);
|
||||||
}
|
}
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'jeopardy-question.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'jeopardy-question.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -48,6 +48,6 @@ module.exports = class LicensePlateCommand extends Command {
|
|||||||
ctx.textBaseline = 'middle';
|
ctx.textBaseline = 'middle';
|
||||||
ctx.font = this.client.fonts.get('LicensePlate.ttf').toCanvasString(180);
|
ctx.font = this.client.fonts.get('LicensePlate.ttf').toCanvasString(180);
|
||||||
ctx.fillText(text.toUpperCase(), base.width / 2, base.height / 2, 700);
|
ctx.fillText(text.toUpperCase(), base.width / 2, base.height / 2, 700);
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'license-plate.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'license-plate.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -50,6 +50,6 @@ module.exports = class SpeedLimitCommand extends Command {
|
|||||||
ctx.font = this.client.fonts.get('HWYGWDE.ttf').toCanvasString(360);
|
ctx.font = this.client.fonts.get('HWYGWDE.ttf').toCanvasString(360);
|
||||||
ctx.fillStyle = 'black';
|
ctx.fillStyle = 'black';
|
||||||
ctx.fillText(limit.toUpperCase(), 313, 356, 475);
|
ctx.fillText(limit.toUpperCase(), 313, 356, 475);
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'speed-limit.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'speed-limit.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -85,6 +85,6 @@ module.exports = class SpongebobTimeCardCommand extends Command {
|
|||||||
ctx.fillStyle = 'black';
|
ctx.fillStyle = 'black';
|
||||||
ctx.fillText(lines[i], canvas.width / 2, height);
|
ctx.fillText(lines[i], canvas.width / 2, height);
|
||||||
}
|
}
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'spongebob-time-card.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'spongebob-time-card.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ module.exports = class TweetCommand extends Command {
|
|||||||
ctx.clip();
|
ctx.clip();
|
||||||
}
|
}
|
||||||
ctx.drawImage(avatar, 17, 84, 52, 52);
|
ctx.drawImage(avatar, 17, 84, 52, 52);
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'tweet.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'tweet.png' }] });
|
||||||
}
|
}
|
||||||
|
|
||||||
roundedPath(ctx, radius, x, y, imageWidth, imageHeight) {
|
roundedPath(ctx, radius, x, y, imageWidth, imageHeight) {
|
||||||
|
|||||||
@@ -117,6 +117,6 @@ module.exports = class UndertaleCommand extends Command {
|
|||||||
for (let i = 0; i < lines; i++) {
|
for (let i = 0; i < lines; i++) {
|
||||||
ctx.fillText(text[i], 174, 22 + (22 * i) + (22 * i) + (space * i));
|
ctx.fillText(text[i], 174, 22 + (22 * i) + (22 * i) + (space * i));
|
||||||
}
|
}
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: `undertale-${character}.png` }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: `undertale-${character}.png` }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -64,6 +64,6 @@ module.exports = class ZeroDialogueCommand extends Command {
|
|||||||
let text = wrapText(ctx, quote, 425);
|
let text = wrapText(ctx, quote, 425);
|
||||||
text = text.length > 2 ? `${text.slice(0, 2).join('\n')}...` : text.join('\n');
|
text = text.length > 2 ? `${text.slice(0, 2).join('\n')}...` : text.join('\n');
|
||||||
fillTextWithBreaks(ctx, text, 8, 8);
|
fillTextWithBreaks(ctx, text, 8, 8);
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'zero-dialogue.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'zero-dialogue.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ module.exports = class AnalogClockCommand extends Command {
|
|||||||
this.drawNumbers(ctx, radius);
|
this.drawNumbers(ctx, radius);
|
||||||
this.drawTime(ctx, radius, time);
|
this.drawTime(ctx, radius, time);
|
||||||
return msg.say(`${subMain || sub || main}${parens}`, {
|
return msg.say(`${subMain || sub || main}${parens}`, {
|
||||||
files: [{ attachment: canvas.toBuffer(), name: 'analog-clock.png' }]
|
files: [{ attachment: canvas.toBuffer('image/png'), name: 'analog-clock.png' }]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ module.exports = class ApprovedCommand extends Command {
|
|||||||
ctx.drawImage(data, 0, 0);
|
ctx.drawImage(data, 0, 0);
|
||||||
const { x, y, width, height } = centerImage(base, data);
|
const { x, y, width, height } = centerImage(base, data);
|
||||||
ctx.drawImage(base, x, y, width, height);
|
ctx.drawImage(base, x, y, 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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'approved.png' }] });
|
return msg.say({ files: [{ attachment, name: 'approved.png' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ module.exports = class BlurCommand extends Command {
|
|||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
ctx.drawImage(data, 0, 0);
|
ctx.drawImage(data, 0, 0);
|
||||||
stackBlur.canvasRGBA(canvas, 0, 0, canvas.width, canvas.height, radius);
|
stackBlur.canvasRGBA(canvas, 0, 0, canvas.width, canvas.height, radius);
|
||||||
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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'blur.png' }] });
|
return msg.say({ files: [{ attachment, name: 'blur.png' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,6 @@ module.exports = class BobRossCommand extends Command {
|
|||||||
const { x, y, width, height } = centerImagePart(data, 440, 440, 15, 20);
|
const { x, y, width, height } = centerImagePart(data, 440, 440, 15, 20);
|
||||||
ctx.drawImage(data, x, y, width, height);
|
ctx.drawImage(data, x, y, width, height);
|
||||||
ctx.drawImage(base, 0, 0);
|
ctx.drawImage(base, 0, 0);
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'bob-ross.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'bob-ross.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ module.exports = class BrazzersCommand extends Command {
|
|||||||
const width = data.width / 3;
|
const width = data.width / 3;
|
||||||
const height = Math.round(width / ratio);
|
const height = Math.round(width / ratio);
|
||||||
ctx.drawImage(base, 0, data.height - height, width, height);
|
ctx.drawImage(base, 0, 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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'brazzers.png' }] });
|
return msg.say({ files: [{ attachment, name: 'brazzers.png' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ module.exports = class ChocolateMilkCommand extends Command {
|
|||||||
ctx.drawImage(base, 0, 0, overlay.width, height);
|
ctx.drawImage(base, 0, 0, overlay.width, height);
|
||||||
if (direction === 'right') ctx.setTransform(1, 0, 0, 1, 0, 0);
|
if (direction === 'right') ctx.setTransform(1, 0, 0, 1, 0, 0);
|
||||||
ctx.drawImage(overlay, 0, 0);
|
ctx.drawImage(overlay, 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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'chocolate-milk.png' }] });
|
return msg.say({ files: [{ attachment, name: 'chocolate-milk.png' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,6 @@ module.exports = class CircleCommand extends Command {
|
|||||||
ctx.closePath();
|
ctx.closePath();
|
||||||
ctx.clip();
|
ctx.clip();
|
||||||
ctx.drawImage(data, (canvas.width / 2) - (data.width / 2), (canvas.height / 2) - (data.height / 2));
|
ctx.drawImage(data, (canvas.width / 2) - (data.width / 2), (canvas.height / 2) - (data.height / 2));
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'circle.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'circle.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ module.exports = class ColorCommand extends Command {
|
|||||||
ctx.fillStyle = color.toLowerCase();
|
ctx.fillStyle = color.toLowerCase();
|
||||||
ctx.fillRect(0, 0, 250, 250);
|
ctx.fillRect(0, 0, 250, 250);
|
||||||
return msg.say(`${color.toUpperCase()} - ${name[1]}`, {
|
return msg.say(`${color.toUpperCase()} - ${name[1]}`, {
|
||||||
files: [{ attachment: canvas.toBuffer(), name: 'color.png' }]
|
files: [{ attachment: canvas.toBuffer('image/png'), name: 'color.png' }]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ module.exports = class CommunistCommand extends Command {
|
|||||||
ctx.globalAlpha = 0.5;
|
ctx.globalAlpha = 0.5;
|
||||||
ctx.drawImage(base, x + (width / 20), y + (height / 20), width * 0.9, height * 0.9);
|
ctx.drawImage(base, x + (width / 20), y + (height / 20), width * 0.9, height * 0.9);
|
||||||
ctx.globalAlpha = 1;
|
ctx.globalAlpha = 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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'communist.png' }] });
|
return msg.say({ files: [{ attachment, name: 'communist.png' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ module.exports = class ContrastCommand extends Command {
|
|||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
ctx.drawImage(data, 0, 0);
|
ctx.drawImage(data, 0, 0);
|
||||||
contrast(ctx, 0, 0, data.width, data.height);
|
contrast(ctx, 0, 0, data.width, data.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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'contrast.png' }] });
|
return msg.say({ files: [{ attachment, name: 'contrast.png' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ module.exports = class CropToContentCommand extends Command {
|
|||||||
if (canvas.width === data.width && canvas.height === data.height) {
|
if (canvas.width === data.width && canvas.height === data.height) {
|
||||||
return msg.say('Looks like this image is already cropped to its content.');
|
return msg.say('Looks like this image is already cropped to its content.');
|
||||||
}
|
}
|
||||||
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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'crop-to-content.png' }] });
|
return msg.say({ files: [{ attachment, name: 'crop-to-content.png' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ module.exports = class DesaturateCommand extends Command {
|
|||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
ctx.drawImage(data, 0, 0);
|
ctx.drawImage(data, 0, 0);
|
||||||
desaturate(ctx, level, 0, 0, data.width, data.height);
|
desaturate(ctx, level, 0, 0, data.width, data.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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'desaturate.png' }] });
|
return msg.say({ files: [{ attachment, name: 'desaturate.png' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,6 @@ module.exports = class DexterCommand extends Command {
|
|||||||
const { x, y, width, height } = centerImagePart(data, 225, 225, 234, 274);
|
const { x, y, width, height } = centerImagePart(data, 225, 225, 234, 274);
|
||||||
ctx.drawImage(data, x, y, width, height);
|
ctx.drawImage(data, x, y, width, height);
|
||||||
ctx.rotate(11 * (Math.PI / 180));
|
ctx.rotate(11 * (Math.PI / 180));
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'dexter.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'dexter.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ module.exports = class DistortCommand extends Command {
|
|||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
ctx.drawImage(data, 0, 0);
|
ctx.drawImage(data, 0, 0);
|
||||||
distort(ctx, level, 0, 0, data.width, data.height);
|
distort(ctx, level, 0, 0, data.width, data.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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'distort.png' }] });
|
return msg.say({ files: [{ attachment, name: 'distort.png' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ module.exports = class FireFrameCommand extends Command {
|
|||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
drawImageWithTint(ctx, data, '#fc671e', 0, 0, data.width, data.height);
|
drawImageWithTint(ctx, data, '#fc671e', 0, 0, data.width, data.height);
|
||||||
ctx.drawImage(base, 0, 0, data.width, data.height);
|
ctx.drawImage(base, 0, 0, data.width, data.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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'fire-frame.png' }] });
|
return msg.say({ files: [{ attachment, name: 'fire-frame.png' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ module.exports = class FishEyeCommand extends Command {
|
|||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
ctx.drawImage(data, 0, 0);
|
ctx.drawImage(data, 0, 0);
|
||||||
fishEye(ctx, level, 0, 0, data.width, data.height);
|
fishEye(ctx, level, 0, 0, data.width, data.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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'fish-eye.png' }] });
|
return msg.say({ files: [{ attachment, name: 'fish-eye.png' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ module.exports = class FrameCommand extends Command {
|
|||||||
ctx.drawImage(data, x, y, width, height);
|
ctx.drawImage(data, x, y, width, height);
|
||||||
ctx.drawImage(base, 0, 0);
|
ctx.drawImage(base, 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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: `frame-${frame.file}` }] });
|
return msg.say({ files: [{ attachment, name: `frame-${frame.file}` }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ module.exports = class GhostCommand extends Command {
|
|||||||
ctx.fillRect(0, 0, data.width, data.height);
|
ctx.fillRect(0, 0, data.width, data.height);
|
||||||
ctx.globalAlpha = 0.25;
|
ctx.globalAlpha = 0.25;
|
||||||
ctx.drawImage(data, 0, 0);
|
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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'ghost.png' }] });
|
return msg.say({ files: [{ attachment, name: 'ghost.png' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ module.exports = class GlassShatterCommand extends Command {
|
|||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
ctx.drawImage(data, 0, 0);
|
ctx.drawImage(data, 0, 0);
|
||||||
ctx.drawImage(base, 0, 0, data.width, data.height);
|
ctx.drawImage(base, 0, 0, data.width, data.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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'glass-shatter.png' }] });
|
return msg.say({ files: [{ attachment, name: 'glass-shatter.png' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ module.exports = class GlitchCommand extends Command {
|
|||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
ctx.drawImage(data, 0, 0);
|
ctx.drawImage(data, 0, 0);
|
||||||
distort(ctx, 20, 0, 0, data.width, data.height, 5);
|
distort(ctx, 20, 0, 0, data.width, data.height, 5);
|
||||||
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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'glitch.png' }] });
|
return msg.say({ files: [{ attachment, name: 'glitch.png' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ module.exports = class GreyscaleCommand extends Command {
|
|||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
ctx.drawImage(data, 0, 0);
|
ctx.drawImage(data, 0, 0);
|
||||||
greyscale(ctx, 0, 0, data.width, data.height);
|
greyscale(ctx, 0, 0, data.width, data.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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'greyscale.png' }] });
|
return msg.say({ files: [{ attachment, name: 'greyscale.png' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ module.exports = class GunCommand extends Command {
|
|||||||
const ratio = (data.height / 2) / base.height;
|
const ratio = (data.height / 2) / base.height;
|
||||||
const width = base.width * ratio;
|
const width = base.width * ratio;
|
||||||
ctx.drawImage(base, data.width - width, data.height - (data.height / 2), width, data.height / 2);
|
ctx.drawImage(base, data.width - width, data.height - (data.height / 2), width, data.height / 2);
|
||||||
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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'gun.png' }] });
|
return msg.say({ files: [{ attachment, name: 'gun.png' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ module.exports = class HandsCommand extends Command {
|
|||||||
const ratio = data.width / base.width;
|
const ratio = data.width / base.width;
|
||||||
const height = base.height * ratio;
|
const height = base.height * ratio;
|
||||||
ctx.drawImage(base, 0, data.height - height, data.width, height);
|
ctx.drawImage(base, 0, data.height - height, data.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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'hands.png' }] });
|
return msg.say({ files: [{ attachment, name: 'hands.png' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ module.exports = class IfunnyCommand extends Command {
|
|||||||
ctx.fillStyle = '#181619';
|
ctx.fillStyle = '#181619';
|
||||||
ctx.fillRect(0, canvas.height - base.height, canvas.width, base.height);
|
ctx.fillRect(0, canvas.height - base.height, canvas.width, base.height);
|
||||||
ctx.drawImage(base, canvas.width - base.width, canvas.height - base.height);
|
ctx.drawImage(base, canvas.width - base.width, canvas.height - base.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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'ifunny.png' }] });
|
return msg.say({ files: [{ attachment, name: 'ifunny.png' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ module.exports = class InvertCommand extends Command {
|
|||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
ctx.drawImage(data, 0, 0);
|
ctx.drawImage(data, 0, 0);
|
||||||
invert(ctx, 0, 0, data.width, data.height);
|
invert(ctx, 0, 0, data.width, data.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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'invert.png' }] });
|
return msg.say({ files: [{ attachment, name: 'invert.png' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,6 @@ module.exports = class LegoIconCommand extends Command {
|
|||||||
ctx.clip();
|
ctx.clip();
|
||||||
const height = 764 / data.width;
|
const height = 764 / data.width;
|
||||||
ctx.drawImage(data, (base.width / 2) - (764 / 2), (base.height / 2) - (764 / 2), 764, data.height * height);
|
ctx.drawImage(data, (base.width / 2) - (764 / 2), (base.height / 2) - (764 / 2), 764, data.height * height);
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'lego-icon.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'lego-icon.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ module.exports = class MirrorCommand extends Command {
|
|||||||
ctx.scale(-1, -1);
|
ctx.scale(-1, -1);
|
||||||
}
|
}
|
||||||
ctx.drawImage(data, 0, 0);
|
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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'mirror.png' }] });
|
return msg.say({ files: [{ attachment, name: 'mirror.png' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ module.exports = class MotionBlurCommand extends Command {
|
|||||||
const canvas = createCanvas(data.width, data.height);
|
const canvas = createCanvas(data.width, data.height);
|
||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
motionBlur(ctx, data, 0, 0, data.width, data.height);
|
motionBlur(ctx, data, 0, 0, data.width, data.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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'motion-blur.png' }] });
|
return msg.say({ files: [{ attachment, name: 'motion-blur.png' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ module.exports = class PixelizeCommand extends Command {
|
|||||||
const canvas = createCanvas(data.width, data.height);
|
const canvas = createCanvas(data.width, data.height);
|
||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
pixelize(ctx, canvas, data, 0.15, 0, 0, canvas.width, canvas.height);
|
pixelize(ctx, canvas, data, 0.15, 0, 0, canvas.width, canvas.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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'pixelize.png' }] });
|
return msg.say({ files: [{ attachment, name: 'pixelize.png' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ module.exports = class PoliceTapeCommand extends Command {
|
|||||||
ctx.drawImage(data, 0, 0);
|
ctx.drawImage(data, 0, 0);
|
||||||
const { x, y, width, height } = centerImage(base, data);
|
const { x, y, width, height } = centerImage(base, data);
|
||||||
ctx.drawImage(base, x, y, width, height);
|
ctx.drawImage(base, x, y, 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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'police-tape.png' }] });
|
return msg.say({ files: [{ attachment, name: 'police-tape.png' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ module.exports = class RainbowCommand extends Command {
|
|||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
ctx.drawImage(data, 0, 0);
|
ctx.drawImage(data, 0, 0);
|
||||||
ctx.drawImage(base, 0, 0, data.width, data.height);
|
ctx.drawImage(base, 0, 0, data.width, data.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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'rainbow.png' }] });
|
return msg.say({ files: [{ attachment, name: 'rainbow.png' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ module.exports = class RejctedCommand extends Command {
|
|||||||
ctx.drawImage(data, 0, 0);
|
ctx.drawImage(data, 0, 0);
|
||||||
const { x, y, width, height } = centerImage(base, data);
|
const { x, y, width, height } = centerImage(base, data);
|
||||||
ctx.drawImage(base, x, y, width, height);
|
ctx.drawImage(base, x, y, 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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'rejected.png' }] });
|
return msg.say({ files: [{ attachment, name: 'rejected.png' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,6 @@ module.exports = class ResizeCommand extends Command {
|
|||||||
const canvas = createCanvas(width, height);
|
const canvas = createCanvas(width, height);
|
||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
ctx.drawImage(data, 0, 0, width, height);
|
ctx.drawImage(data, 0, 0, width, height);
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'resize.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'resize.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ module.exports = class RotateCommand extends Command {
|
|||||||
ctx.drawImage(data, (canvas.width / 2) - (data.width / 2), (canvas.height / 2) - (data.height / 2));
|
ctx.drawImage(data, (canvas.width / 2) - (data.width / 2), (canvas.height / 2) - (data.height / 2));
|
||||||
ctx.translate(canvas.width / 2, canvas.height / 2);
|
ctx.translate(canvas.width / 2, canvas.height / 2);
|
||||||
ctx.rotate(-degrees * (Math.PI / 180));
|
ctx.rotate(-degrees * (Math.PI / 180));
|
||||||
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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'rotate.png' }] });
|
return msg.say({ files: [{ attachment, name: 'rotate.png' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ module.exports = class SepiaCommand extends Command {
|
|||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
ctx.drawImage(data, 0, 0);
|
ctx.drawImage(data, 0, 0);
|
||||||
sepia(ctx, 0, 0, data.width, data.height);
|
sepia(ctx, 0, 0, data.width, data.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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'sepia.png' }] });
|
return msg.say({ files: [{ attachment, name: 'sepia.png' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ module.exports = class SilhouetteCommand extends Command {
|
|||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
ctx.drawImage(data, 0, 0);
|
ctx.drawImage(data, 0, 0);
|
||||||
silhouette(ctx, 0, 0, data.width, data.height);
|
silhouette(ctx, 0, 0, data.width, data.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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'silhouette.png' }] });
|
return msg.say({ files: [{ attachment, name: 'silhouette.png' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ module.exports = class SipCommand extends Command {
|
|||||||
ctx.drawImage(base, 0, 0, overlay.width, height);
|
ctx.drawImage(base, 0, 0, overlay.width, height);
|
||||||
if (direction === 'right') ctx.setTransform(1, 0, 0, 1, 0, 0);
|
if (direction === 'right') ctx.setTransform(1, 0, 0, 1, 0, 0);
|
||||||
ctx.drawImage(overlay, 0, 0);
|
ctx.drawImage(overlay, 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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'sip.png' }] });
|
return msg.say({ files: [{ attachment, name: 'sip.png' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,6 +60,6 @@ module.exports = class SnapchatCommand extends Command {
|
|||||||
ctx.globalAlpha = 1;
|
ctx.globalAlpha = 1;
|
||||||
ctx.fillStyle = 'white';
|
ctx.fillStyle = 'white';
|
||||||
ctx.fillText(text, base.width / 2, barPosition - (barHeight * 0.4));
|
ctx.fillText(text, base.width / 2, barPosition - (barHeight * 0.4));
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'snapchat.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'snapchat.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -76,6 +76,6 @@ module.exports = class SpotifyNowPlayingCommand extends Command {
|
|||||||
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(20);
|
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(20);
|
||||||
ctx.fillText(artist, base.width / 2, 720);
|
ctx.fillText(artist, base.width / 2, 720);
|
||||||
ctx.fillText('Xiao\'s Picks', base.width / 2, 65);
|
ctx.fillText('Xiao\'s Picks', base.width / 2, 65);
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'spotify-now-playing.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'spotify-now-playing.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -32,6 +32,6 @@ module.exports = class SquareCommand extends Command {
|
|||||||
const canvas = createCanvas(dimensions, dimensions);
|
const canvas = createCanvas(dimensions, dimensions);
|
||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
ctx.drawImage(data, (canvas.width / 2) - (data.width / 2), (canvas.height / 2) - (data.height / 2));
|
ctx.drawImage(data, (canvas.width / 2) - (data.width / 2), (canvas.height / 2) - (data.height / 2));
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'square.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'square.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -68,6 +68,6 @@ module.exports = class SteamCardCommand extends Command {
|
|||||||
ctx.fillText(name, 16, 25);
|
ctx.fillText(name, 16, 25);
|
||||||
ctx.fillStyle = 'white';
|
ctx.fillStyle = 'white';
|
||||||
ctx.fillText(name, 15, 24);
|
ctx.fillText(name, 15, 24);
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'steam-card.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'steam-card.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ module.exports = class SubtitleCommand extends Command {
|
|||||||
ctx.fillStyle = 'yellow';
|
ctx.fillStyle = 'yellow';
|
||||||
ctx.fillText(lines[i], base.width / 2, textHeight);
|
ctx.fillText(lines[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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'subtitle.png' }] });
|
return msg.say({ files: [{ attachment, name: 'subtitle.png' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ module.exports = class TintCommand extends Command {
|
|||||||
const canvas = createCanvas(data.width, data.height);
|
const canvas = createCanvas(data.width, data.height);
|
||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
drawImageWithTint(ctx, data, color, 0, 0, data.width, data.height);
|
drawImageWithTint(ctx, data, color, 0, 0, data.width, data.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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'tint.png' }] });
|
return msg.say({ files: [{ attachment, name: 'tint.png' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ module.exports = class VignetteCommand extends Command {
|
|||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
ctx.drawImage(data, 0, 0);
|
ctx.drawImage(data, 0, 0);
|
||||||
vignette(ctx, data.width, data.height);
|
vignette(ctx, data.width, data.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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'vignette.png' }] });
|
return msg.say({ files: [{ attachment, name: 'vignette.png' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,6 @@ module.exports = class WantedCommand extends Command {
|
|||||||
const { x, y, width, height } = centerImagePart(data, 430, 430, 150, 360);
|
const { x, y, width, height } = centerImagePart(data, 430, 430, 150, 360);
|
||||||
ctx.drawImage(data, x, y, width, height);
|
ctx.drawImage(data, x, y, width, height);
|
||||||
sepia(ctx, x, y, width, height);
|
sepia(ctx, x, y, width, height);
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'wanted.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'wanted.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -60,6 +60,6 @@ module.exports = class WildPokemonCommand extends Command {
|
|||||||
ctx.textBaseline = 'top';
|
ctx.textBaseline = 'top';
|
||||||
ctx.font = this.client.fonts.get('PokemonGb.ttf').toCanvasString(16);
|
ctx.font = this.client.fonts.get('PokemonGb.ttf').toCanvasString(16);
|
||||||
ctx.fillText(name.toUpperCase(), 106, 205, 215);
|
ctx.fillText(name.toUpperCase(), 106, 205, 215);
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'wild-pokemon.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'wild-pokemon.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ module.exports = class YouDiedCommand extends Command {
|
|||||||
greyscale(ctx, 0, 0, data.width, data.height);
|
greyscale(ctx, 0, 0, data.width, data.height);
|
||||||
const { x, y, width, height } = centerImage(base, data);
|
const { x, y, width, height } = centerImage(base, data);
|
||||||
ctx.drawImage(base, x, y, width, height);
|
ctx.drawImage(base, x, y, 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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'you-died.png' }] });
|
return msg.say({ files: [{ attachment, name: 'you-died.png' }] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,6 @@ module.exports = class ThreeThousandYearsCommand extends Command {
|
|||||||
ctx.drawImage(base, 0, 0);
|
ctx.drawImage(base, 0, 0);
|
||||||
const { x, y, width, height } = centerImagePart(data, 200, 200, 461, 127);
|
const { x, y, width, height } = centerImagePart(data, 200, 200, 461, 127);
|
||||||
ctx.drawImage(data, x, y, width, height);
|
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);
|
let text = wrapText(ctx, message, 540);
|
||||||
text = text.length > 3 ? `${text.slice(0, 3).join('\n')}...` : text.join('\n');
|
text = text.length > 3 ? `${text.slice(0, 3).join('\n')}...` : text.join('\n');
|
||||||
fillTextWithBreaks(ctx, text, 48, 178);
|
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 = [];
|
const arr = [];
|
||||||
for (let i = 0; i < 12; i++) arr.push(shortened);
|
for (let i = 0; i < 12; i++) arr.push(shortened);
|
||||||
fillTextWithBreaks(ctx, arr.join('\n'), 30, 27);
|
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);
|
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);
|
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);
|
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, 24, 105, 105);
|
||||||
ctx.drawImage(avatar, 249, 223, 105, 105);
|
ctx.drawImage(avatar, 249, 223, 105, 105);
|
||||||
ctx.drawImage(base, 0, 0);
|
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(suggestion1, 30, 251, 90);
|
||||||
ctx.fillText(suggestion2, 167, 258, 75);
|
ctx.fillText(suggestion2, 167, 258, 75);
|
||||||
ctx.fillText(final, 310, 269, 130);
|
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);
|
ctx.fillText(is.toUpperCase(), 163, 202);
|
||||||
await msg.channel.send({ files: [path.join(__dirname, '..', '..', 'assets', 'images', 'catch', 'part-1.png')] });
|
await msg.channel.send({ files: [path.join(__dirname, '..', '..', 'assets', 'images', 'catch', 'part-1.png')] });
|
||||||
await delay(time * 1000);
|
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 img = silhouetted ? this.silhouetteImage(data) : data;
|
||||||
const { x, y, width, height } = centerImagePart(img, gameData.maxWidth, gameData.maxHeight, gameData.x, gameData.y);
|
const { x, y, width, height } = centerImagePart(img, gameData.maxWidth, gameData.maxHeight, gameData.x, gameData.y);
|
||||||
ctx.drawImage(img, x, y, width, height);
|
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) {
|
silhouetteImage(image) {
|
||||||
|
|||||||
@@ -57,6 +57,6 @@ module.exports = class ChangeMyMindCommand extends Command {
|
|||||||
const lines = wrapText(ctx, text, 337);
|
const lines = wrapText(ctx, text, 337);
|
||||||
fillTextWithBreaks(ctx, lines.join('\n'), 142, 430, 337);
|
fillTextWithBreaks(ctx, lines.join('\n'), 142, 430, 337);
|
||||||
ctx.rotate(24 * (Math.PI / 180));
|
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);
|
const height = topMost + ((fontSize + 5) * i);
|
||||||
ctx.fillText(lines[i], 70, height);
|
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.drawImage(data, x, y, width, height);
|
||||||
ctx.rotate(3.79 * (Math.PI / 180));
|
ctx.rotate(3.79 * (Math.PI / 180));
|
||||||
ctx.drawImage(base, 0, 0);
|
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;
|
if ((width + sponge.width) === (sponge.width * (rows > 1 ? 10 : amount))) width = 0;
|
||||||
else width += sponge.width;
|
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';
|
ctx.fillStyle = '#c31a41';
|
||||||
const redLines = wrapText(ctx, redText, 165);
|
const redLines = wrapText(ctx, redText, 165);
|
||||||
fillTextWithBreaks(ctx, redLines.join('\n'), 326, 236);
|
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.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(27);
|
||||||
ctx.fillStyle = 'white';
|
ctx.fillStyle = 'white';
|
||||||
ctx.fillText(shortenText(ctx, text, 610), 375, 565);
|
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');
|
const ctx = canvas.getContext('2d');
|
||||||
ctx.drawImage(base, 0, 0, plate.width, height);
|
ctx.drawImage(base, 0, 0, plate.width, height);
|
||||||
ctx.drawImage(plate, 0, 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.');
|
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||||
return msg.say({ files: [{ attachment, name: 'dislike.png' }] });
|
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.drawImage(girlfriendAvatar, 539, 67, 100, 125);
|
||||||
ctx.rotate(-3.11 * (Math.PI / 180));
|
ctx.rotate(-3.11 * (Math.PI / 180));
|
||||||
ctx.drawImage(otherGirlAvatar, 120, 96, 175, 175);
|
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);
|
const height = yeahTopMost + ((fontSize + 10) * i);
|
||||||
ctx.fillText(yeahLines[i], 768, height);
|
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);
|
const lines = wrapText(ctx, fact, 183);
|
||||||
fillTextWithBreaks(ctx, lines.join('\n'), 119, 306, 183);
|
fillTextWithBreaks(ctx, lines.join('\n'), 119, 306, 183);
|
||||||
ctx.rotate(-15 * (Math.PI / 180));
|
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.fillStyle = 'white';
|
||||||
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(50);
|
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(50);
|
||||||
ctx.fillText(name.toLowerCase(), 365, 400, 240);
|
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);
|
contrast(ctx, 23, 9, 125, 125);
|
||||||
ctx.drawImage(avatar, 117, 382, 75, 75);
|
ctx.drawImage(avatar, 117, 382, 75, 75);
|
||||||
contrast(ctx, 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');
|
const ctx = canvas.getContext('2d');
|
||||||
ctx.drawImage(base, 0, 0, plate.width, height);
|
ctx.drawImage(base, 0, 0, plate.width, height);
|
||||||
ctx.drawImage(plate, 0, height + 1);
|
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.');
|
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' }] });
|
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);
|
const height = topMost + ((fontSize + 20) * i);
|
||||||
ctx.fillText(lines[i], 220, height);
|
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' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user