Swap all files to new font system

This commit is contained in:
Dragon Fire
2021-02-20 10:41:45 -05:00
parent 1eb843f1b2
commit 96f5e73f6f
70 changed files with 220 additions and 387 deletions
+2 -5
View File
@@ -1,14 +1,11 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const GIFEncoder = require('gifencoder');
const { MersenneTwister19937, bool } = require('random-js');
const request = require('node-superfetch');
const path = require('path');
const { streamToArray } = require('../../util/Util');
const frameCount = 52;
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class EjectCommand extends Command {
constructor(client) {
@@ -75,7 +72,7 @@ module.exports = class EjectCommand extends Command {
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.fillStyle = 'white';
ctx.font = '18px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(18);
const stream = encoder.createReadStream();
encoder.start();
encoder.setRepeat(0);
+3 -4
View File
@@ -1,9 +1,8 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
const { greyscale } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'CoffinStone.otf'), { family: 'Coffin Stone' });
module.exports = class RipCommand extends Command {
constructor(client) {
@@ -63,12 +62,12 @@ module.exports = class RipCommand extends Command {
greyscale(ctx, 194, 399, 500, 500);
ctx.textBaseline = 'top';
ctx.textAlign = 'center';
ctx.font = '62px Coffin Stone';
ctx.font = this.client.fonts.get('CoffinStone.otf').toCanvasString(62);
ctx.fillStyle = 'black';
ctx.fillText(user.username, 438, 330, 500);
ctx.fillStyle = 'white';
if (cause) ctx.fillText(cause, 438, 910, 500);
ctx.font = '37px Coffin Stone';
ctx.font = this.client.fonts.get('CoffinStone.otf').toCanvasString(37);
ctx.fillText('In Loving Memory of', 438, 292);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'rip.png' }] });
} catch (err) {
@@ -1,11 +1,8 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
const { shortenText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class SteamNowPlayingClassicCommand extends Command {
constructor(client) {
@@ -62,7 +59,7 @@ module.exports = class SteamNowPlayingClassicCommand extends Command {
ctx.drawImage(base, 0, 0);
ctx.drawImage(avatar, 21, 21, 32, 32);
ctx.fillStyle = '#90ba3c';
ctx.font = '10px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(10);
ctx.fillText(user.username, 63, 26);
ctx.fillText(shortenText(ctx, game, 160), 63, 54);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'steam-now-playing-classic.png' }] });
+2 -5
View File
@@ -1,11 +1,8 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
const { shortenText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class SteamNowPlayingCommand extends Command {
constructor(client) {
@@ -60,7 +57,7 @@ module.exports = class SteamNowPlayingCommand extends Command {
ctx.drawImage(base, 0, 0);
ctx.drawImage(avatar, 26, 26, 41, 42);
ctx.fillStyle = '#90b93c';
ctx.font = '14px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(14);
ctx.fillText(user.username, 80, 34);
ctx.fillText(shortenText(ctx, game, 200), 80, 70);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'steam-now-playing.png' }] });
+2 -3
View File
@@ -1,9 +1,8 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { firstUpperCase, list } = require('../../util/Util');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Ace-Attorney.ttf'), { family: 'Ace Attorney' });
const characters = {
phoenix: ['phoenix', 'wright', 'naruhodo', 'ryuuichi', 'ryu', 'nick'],
edgeworth: ['miles', 'edgeworth', 'mitsurugi', 'reiji', 'edgey'],
@@ -78,7 +77,7 @@ module.exports = class AceAttorneyCommand extends Command {
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.font = '14px Ace Attorney';
ctx.font = this.client.fonts.get('Ace-Attorney.ttf').toCanvasString(14);
ctx.fillStyle = 'white';
ctx.textBaseline = 'top';
ctx.fillText(firstUpperCase(character), 6, 176);
+2 -3
View File
@@ -1,8 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { shortenText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Minecraftia.ttf'), { family: 'Minecraftia' });
module.exports = class AchievementCommand extends Command {
constructor(client) {
@@ -52,7 +51,7 @@ module.exports = class AchievementCommand extends Command {
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.font = '17px Minecraftia';
ctx.font = this.client.fonts.get('Minecraftia.ttf').toCanvasString(17);
ctx.fillStyle = '#ffff00';
ctx.fillText('Achievement Get!', 60, 40);
ctx.fillStyle = '#ffffff';
+3 -4
View File
@@ -1,7 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Konosuba.ttf'), { family: 'Konosuba' });
module.exports = class AxisCultSignUpCommand extends Command {
constructor(client) {
@@ -64,14 +63,14 @@ module.exports = class AxisCultSignUpCommand extends Command {
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.font = '96px Konosuba';
ctx.font = this.client.fonts.get('Konosuba.ttf').toCanvasString(96);
ctx.fillText(msg.author.username, 960, 1558);
ctx.fillText(gender, 960, 1752);
ctx.fillText(age, 1700, 1752);
ctx.fillText('XXX-XXX-XXXX', 960, 1960);
ctx.fillText(profession, 960, 2169);
ctx.fillText('Xiao', 960, 2370);
ctx.font = '123px Konosuba';
ctx.font = this.client.fonts.get('Konosuba.ttf').toCanvasString(123);
ctx.fillText('ERIS PADS\nHER CHEST!', 1037, 2874);
return msg.say({ files: [{ attachment: canvas.toBuffer('image/jpeg'), name: 'axis-cult-sign-up.jpg' }] });
}
+3 -4
View File
@@ -1,8 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Bold.ttf'), { family: 'Noto', weight: 'bold' });
module.exports = class CautionCommand extends Command {
constructor(client) {
@@ -49,11 +48,11 @@ module.exports = class CautionCommand extends Command {
ctx.drawImage(base, 0, 0);
ctx.textAlign = 'center';
ctx.textBaseline = 'top';
ctx.font = 'normal bold 60px Noto';
ctx.font = this.client.fonts.get('Noto-Bold.ttf').toCanvasString(60);
let fontSize = 60;
while (ctx.measureText(text).width > 3311) {
fontSize--;
ctx.font = `normal bold ${fontSize}px Noto`;
ctx.font = this.client.fonts.get('Noto-Bold.ttf').toCanvasString(fontSize);
}
const lines = await wrapText(ctx, text.toUpperCase(), 895);
const topMost = 470 - (((fontSize * lines.length) / 2) + ((20 * (lines.length - 1)) / 2));
+2 -3
View File
@@ -1,8 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const moment = require('moment');
const path = require('path');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'oldengl.ttf'), { family: 'Old English Text MT' });
module.exports = class CertificateCommand extends Command {
constructor(client) {
@@ -59,7 +58,7 @@ module.exports = class CertificateCommand extends Command {
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.font = '30px Old English Text MT';
ctx.font = this.client.fonts.get('oldengl.ttf').toCanvasString(30);
ctx.textBaseline = 'top';
ctx.textAlign = 'center';
ctx.fillText(reason, 518, 273);
+2 -6
View File
@@ -1,11 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Futura Condensed Bold.otf'), {
family: 'Futura',
weight: 'bold'
});
module.exports = class ChineseRestaurantCommand extends Command {
constructor(client) {
@@ -52,7 +48,7 @@ module.exports = class ChineseRestaurantCommand extends Command {
ctx.fillStyle = '#1f1f1f';
ctx.textAlign = 'center';
ctx.textBaseline = 'top';
ctx.font = 'normal bold 28px Futura';
ctx.font = this.client.fonts.get('Futura Condensed Bold.otf').toCanvasString(28);
const lines = await wrapText(ctx, text.toUpperCase(), 340);
if (lines.length === 1) {
ctx.fillText(lines[0], base.width / 2, 288);
+3 -4
View File
@@ -1,8 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Bold.ttf'), { family: 'Noto', weight: 'bold' });
module.exports = class DangerCommand extends Command {
constructor(client) {
@@ -49,11 +48,11 @@ module.exports = class DangerCommand extends Command {
ctx.drawImage(base, 0, 0);
ctx.textAlign = 'center';
ctx.textBaseline = 'top';
ctx.font = 'normal bold 60px Noto';
ctx.font = this.client.fonts.get('Noto-Bold.ttf').toCanvasString(60);
let fontSize = 60;
while (ctx.measureText(text).width > 2520) {
fontSize--;
ctx.font = `normal bold ${fontSize}px Noto`;
ctx.font = this.client.fonts.get('Noto-Bold.ttf').toCanvasString(fontSize);
}
const lines = await wrapText(ctx, text.toUpperCase(), 840);
const topMost = 510 - (((fontSize * lines.length) / 2) + ((20 * (lines.length - 1)) / 2));
+3 -7
View File
@@ -1,11 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'lmroman10-italic.otf'), {
family: 'Latin Modern Roman',
style: 'italic'
});
module.exports = class GandhiQuoteCommand extends Command {
constructor(client) {
@@ -46,12 +42,12 @@ module.exports = class GandhiQuoteCommand extends Command {
ctx.drawImage(base, 0, 0);
ctx.textAlign = 'center';
ctx.textBaseline = 'top';
ctx.font = 'italic 50px Latin Modern Roman';
ctx.font = this.client.fonts.get('lmroman10-italic.otf').toCanvasString(50);
ctx.fillStyle = 'white';
let fontSize = 50;
while (ctx.measureText(quote).width > 945) {
fontSize--;
ctx.font = `italic ${fontSize}px Latin Modern Roman`;
ctx.font = this.client.fonts.get('lmroman10-italic.otf').toCanvasString(fontSize);
}
const lines = await wrapText(ctx, quote, 270);
const topMost = 180 - (((fontSize * lines.length) / 2) + ((20 * (lines.length - 1)) / 2));
+2 -3
View File
@@ -1,8 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'EHSMB.ttf'), { family: 'Electronic Highway Sign' });
module.exports = class HighwaySignCommand extends Command {
constructor(client) {
@@ -49,7 +48,7 @@ module.exports = class HighwaySignCommand extends Command {
ctx.fillStyle = '#efe390';
ctx.textAlign = 'center';
ctx.textBaseline = 'top';
ctx.font = '18px Electronic Highway Sign';
ctx.font = this.client.fonts.get('EHSMB.ttf').toCanvasString(18);
const lines = await wrapText(ctx, text.toUpperCase(), 178);
if (lines.length === 1) {
ctx.fillText(lines[0], 318, 109);
+2 -3
View File
@@ -1,7 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'HollywoodStar.otf'), { family: 'Hollywood Star' });
module.exports = class HollywoodStarCommand extends Command {
constructor(client) {
@@ -51,7 +50,7 @@ module.exports = class HollywoodStarCommand extends Command {
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.font = '28px Hollywood Star';
ctx.font = this.client.fonts.get('HollywoodStar.otf').toCanvasString(28);
ctx.fillStyle = '#fadfd4';
ctx.textAlign = 'center';
ctx.textBaseline = 'top';
+2 -4
View File
@@ -1,8 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, registerFont } = require('canvas');
const path = require('path');
const { createCanvas } = require('canvas');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'OPTIKorinna-Agency.otf'), { family: 'Korinna' });
module.exports = class JeopardyQuestionCommand extends Command {
constructor(client) {
@@ -49,7 +47,7 @@ module.exports = class JeopardyQuestionCommand extends Command {
ctx.textAlign = 'center';
ctx.textBaseline = 'top';
ctx.fillStyle = 'white';
ctx.font = '62px Korinna';
ctx.font = this.client.fonts.get('OPTIKorinna-Agency.otf').toCanvasString(62);
const lines = await wrapText(ctx, text.toUpperCase(), 813);
const topMost = (canvas.height / 2) - (((52 * lines.length) / 2) + ((20 * (lines.length - 1)) / 2));
for (let i = 0; i < lines.length; i++) {
+2 -3
View File
@@ -1,7 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'LicensePlate.ttf'), { family: 'License Plate' });
module.exports = class LicensePlateCommand extends Command {
constructor(client) {
@@ -47,7 +46,7 @@ module.exports = class LicensePlateCommand extends Command {
ctx.drawImage(base, 0, 0);
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.font = '180px License Plate';
ctx.font = this.client.fonts.get('LicensePlate.ttf').toCanvasString(180);
ctx.fillText(text.toUpperCase(), base.width / 2, base.height / 2, 700);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'license-plate.png' }] });
}
+2 -3
View File
@@ -1,7 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'HWYGWDE.ttf'), { family: 'Highway Gothic' });
module.exports = class SpeedLimitCommand extends Command {
constructor(client) {
@@ -48,7 +47,7 @@ module.exports = class SpeedLimitCommand extends Command {
ctx.drawImage(base, 0, 0);
ctx.textBaseline = 'top';
ctx.textAlign = 'center';
ctx.font = '360px Highway Gothic';
ctx.font = this.client.fonts.get('HWYGWDE.ttf').toCanvasString(360);
ctx.fillStyle = 'black';
ctx.fillText(limit.toUpperCase(), 313, 356, 475);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'speed-limit.png' }] });
+2 -3
View File
@@ -1,8 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Spongeboytt1.ttf'), { family: 'Spongeboytt1' });
module.exports = class SpongebobTimeCardCommand extends Command {
constructor(client) {
@@ -58,7 +57,7 @@ module.exports = class SpongebobTimeCardCommand extends Command {
ctx.drawImage(base, 0, 0);
ctx.textAlign = 'center';
ctx.textBaseline = 'top';
ctx.font = '115px Spongeboytt1';
ctx.font = this.client.fonts.get('Spongeboytt1.ttf').toCanvasString(115);
const lines = await wrapText(ctx, text.toUpperCase(), 1800);
const topMost = (canvas.height / 2) - (((115 * lines.length) / 2) + ((60 * (lines.length - 1)) / 2));
for (let i = 0; i < lines.length; i++) {
+3 -7
View File
@@ -1,11 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Bold.ttf'), { family: 'Noto', weight: 'bold' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class SpotifyNowPlayingCommand extends Command {
constructor(client) {
@@ -76,11 +72,11 @@ module.exports = class SpotifyNowPlayingCommand extends Command {
ctx.drawImage(base, 0, 0);
ctx.textBaseline = 'top';
ctx.textAlign = 'center';
ctx.font = 'normal bold 25px Noto';
ctx.font = this.client.fonts.get('Noto-Bold.ttf').toCanvasString(25);
ctx.fillStyle = 'white';
ctx.fillText(name, base.width / 2, 685);
ctx.fillStyle = '#bdbec2';
ctx.font = '20px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(20);
ctx.fillText(artist, base.width / 2, 720);
ctx.fillText('Xiao\'s Picks', base.width / 2, 65);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'spotify-now-playing.png' }] });
+2 -5
View File
@@ -1,10 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class SteamCardCommand extends Command {
constructor(client) {
@@ -68,7 +65,7 @@ module.exports = class SteamCardCommand extends Command {
const height = 205 / data.width;
ctx.drawImage(data, 12, 19, 205, height * data.height);
ctx.drawImage(base, 0, 0);
ctx.font = '14px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(14);
ctx.fillStyle = 'black';
ctx.fillText(name, 16, 25);
ctx.fillStyle = 'white';
+2 -5
View File
@@ -1,11 +1,8 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class SubtitleCommand extends Command {
constructor(client) {
@@ -53,7 +50,7 @@ module.exports = class SubtitleCommand extends Command {
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
const fontSize = Math.round(base.height / 15);
ctx.font = `${fontSize}px Noto`;
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize);
ctx.fillStyle = 'yellow';
ctx.textAlign = 'center';
const lines = await wrapText(ctx, text, base.width - 10);
+13 -17
View File
@@ -1,15 +1,11 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const moment = require('moment');
const request = require('node-superfetch');
const path = require('path');
const { base64, formatNumberK } = require('../../util/Util');
const { wrapText } = require('../../util/Canvas');
const { TWITTER_KEY, TWITTER_SECRET } = process.env;
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Bold.ttf'), { family: 'Noto', weight: 'bold' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class TweetCommand extends Command {
constructor(client) {
@@ -66,7 +62,7 @@ module.exports = class TweetCommand extends Command {
const base2 = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'tweet', 'bg-2.png'));
const canvas = createCanvas(base1.width, base1.height + base2.height);
const ctx = canvas.getContext('2d');
ctx.font = '23px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(23);
const lines = await wrapText(ctx, text, 710);
const lineBreakLen = text.split('\n').length;
const linesLen = (23 * lines.length)
@@ -84,7 +80,7 @@ module.exports = class TweetCommand extends Command {
const base2StartY = base1.height + linesLen;
ctx.drawImage(base2, 0, base2StartY);
ctx.textBaseline = 'top';
ctx.font = 'normal bold 18px Noto';
ctx.font = this.client.fonts.get('Noto-Bold.ttf').toCanvasString(18);
ctx.fillStyle = 'white';
ctx.fillText(userData.name, 105, 84);
if (userData.verified) {
@@ -94,52 +90,52 @@ module.exports = class TweetCommand extends Command {
const nameLen = ctx.measureText(userData.name).width;
ctx.drawImage(verified, 105 + nameLen + 4, 88, 18, 18);
}
ctx.font = '17px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(17);
ctx.fillStyle = '#8899a6';
ctx.fillText(`@${userData.screenName}`, 106, 111);
ctx.fillStyle = 'white';
ctx.font = '23px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(23);
ctx.fillText(lines.join('\n'), 32, 164);
ctx.fillStyle = '#8899a6';
ctx.font = '18px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(18);
const time = moment().format('h:mm A ∙ MMMM D, YYYY ∙');
ctx.fillText(time, 31, base2StartY + 16);
const timeLen = ctx.measureText(time).width;
ctx.fillStyle = '#1b95e0';
ctx.fillText('Twitter for Xiao', 31 + timeLen + 6, base2StartY + 16);
ctx.fillStyle = '#8899a6';
ctx.font = '16px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(16);
ctx.fillText(formatNumberK(replies), 87, base2StartY + 139);
ctx.fillText(formatNumberK(likes), 509, base2StartY + 139);
ctx.fillText(formatNumberK(retweets + quoteTweets), 300, base2StartY + 139);
let currentLen = 31;
ctx.fillStyle = 'white';
ctx.font = 'normal bold 18px Noto';
ctx.font = this.client.fonts.get('Noto-Bold.ttf').toCanvasString(18);
ctx.fillText(formatNumberK(retweets), currentLen, base2StartY + 77);
currentLen += ctx.measureText(formatNumberK(retweets)).width;
currentLen += 5;
ctx.fillStyle = '#8899a6';
ctx.font = '18px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(18);
ctx.fillText('Retweets', currentLen, base2StartY + 77);
currentLen += ctx.measureText('Retweets').width;
currentLen += 10;
ctx.fillStyle = 'white';
ctx.font = 'normal bold 18px Noto';
ctx.font = this.client.fonts.get('Noto-Bold.ttf').toCanvasString(18);
ctx.fillText(formatNumberK(quoteTweets), currentLen, base2StartY + 77);
currentLen += ctx.measureText(formatNumberK(quoteTweets)).width;
currentLen += 5;
ctx.fillStyle = '#8899a6';
ctx.font = '18px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(18);
ctx.fillText('Quote Tweets', currentLen, base2StartY + 77);
currentLen += ctx.measureText('Quote Tweets').width;
currentLen += 10;
ctx.fillStyle = 'white';
ctx.font = 'normal bold 18px Noto';
ctx.font = this.client.fonts.get('Noto-Bold.ttf').toCanvasString(18);
ctx.fillText(formatNumberK(likes), currentLen, base2StartY + 77);
currentLen += ctx.measureText(formatNumberK(likes)).width;
currentLen += 5;
ctx.fillStyle = '#8899a6';
ctx.font = '18px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(18);
ctx.fillText('Likes', currentLen, base2StartY + 77);
ctx.beginPath();
ctx.arc(30 + 32, 84 + 32, 32, 0, Math.PI * 2);
+7 -18
View File
@@ -1,20 +1,9 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { list } = require('../../util/Util');
const { wrapText } = require('../../util/Canvas');
const characters = require('../../assets/json/undertale');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'DeterminationMono.ttf'), {
family: 'DeterminationMono'
});
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'UndertalePapyrus.ttf'), {
family: 'UndertalePapyrus'
});
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'UndertaleSans.ttf'), { family: 'UndertaleSans' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'pixelated-wingdings.ttf'), {
family: 'Pixelated Wingdings'
});
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'apple_kid.ttf'), { family: 'Apple Kid' });
module.exports = class UndertaleCommand extends Command {
constructor(client) {
@@ -94,16 +83,16 @@ module.exports = class UndertaleCommand extends Command {
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
let font = 'DeterminationMono';
let font = 'DeterminationMono.ttf';
let space = -3;
switch (character) {
case 'sans':
font = 'UndertaleSans';
font = 'UndertaleSans.ttf';
quote = quote.toLowerCase();
space = -4;
break;
case 'papyrus':
font = 'UndertalePapyrus';
font = 'UndertalePapyrus.ttf';
quote = quote.toUpperCase();
space = -5;
break;
@@ -111,18 +100,18 @@ module.exports = class UndertaleCommand extends Command {
quote = quote.toLowerCase();
break;
case 'gaster':
font = 'Pixelated Wingdings';
font = 'pixelated-wingdings.ttf';
space = -4;
break;
case 'ness':
font = 'Apple Kid';
font = 'apple_kid.ttf';
space = -2;
break;
case 'temmie':
quote = this.client.registry.commands.get('temmie').temmize(quote);
break;
}
ctx.font = `32px ${font}`;
ctx.font = this.client.fonts.get(font).toCanvasString(32);
ctx.fillStyle = 'white';
ctx.textBaseline = 'top';
const text = await wrapText(ctx, quote, 385);
+2 -3
View File
@@ -1,9 +1,8 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
const { centerImagePart, greyscale, pixelize } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'PokemonGb.ttf'), { family: 'Pokemon GB' });
module.exports = class WildPokemonCommand extends Command {
constructor(client) {
@@ -60,7 +59,7 @@ module.exports = class WildPokemonCommand extends Command {
pixelize(ctx, canvas, data, 0.30, x, y, width, height);
greyscale(ctx, x, y, width, height);
ctx.textBaseline = 'top';
ctx.font = '16px Pokemon GB';
ctx.font = this.client.fonts.get('PokemonGb.ttf').toCanvasString(16);
ctx.fillText(name.toUpperCase(), 110, 203, 215);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'wild-pokemon.png' }] });
} catch (err) {
+9 -17
View File
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
const { stripIndents } = require('common-tags');
@@ -8,15 +8,6 @@ const { wrapText } = require('../../util/Canvas');
const types = ['monster', 'spell', 'trap'];
const monsterTypes = ['normal', 'effect', 'ritual', 'fusion', 'synchro', 'xyz', 'link', 'token'];
const atrs = ['dark', 'divine', 'earth', 'fire', 'laugh', 'light', 'water', 'wind'];
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Matrix Book.ttf'), { family: 'Matrix Book' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Matrix Small Caps.ttf'), { family: 'Matrix' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Stone Serif.ttf'), { family: 'Stone Serif' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Stone Serif Small Caps.ttf'), {
family: 'Stone Serif Small Caps'
});
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Stone Serif LT Italic.ttf'), {
family: 'Stone Serif LT Italic'
});
module.exports = class YuGiOhGenCommand extends Command {
constructor(client) {
@@ -126,33 +117,34 @@ module.exports = class YuGiOhGenCommand extends Command {
}
ctx.fillStyle = monsterType === 'xyz' || monsterType === 'link' ? 'white' : 'black';
ctx.textBaseline = 'top';
ctx.font = '87px Matrix';
ctx.font = this.client.fonts.get('Matrix Book.ttf').toCanvasString(87);
ctx.fillText(name, 60, 57, 620);
ctx.fillStyle = 'black';
if (type === 'monster') {
ctx.font = '31px Stone Serif Small Caps';
ctx.font = this.client.fonts.get('Stone Serif Small Caps.ttf').toCanvasString(31);
let typeStr = `[ ${firstUpperCase(species)} / ${firstUpperCase(monsterType)}`;
if (monsterType !== 'normal' && monsterType !== 'effect' && monsterType !== 'token') {
typeStr += ' / Effect';
}
typeStr += ' ]';
ctx.fillText(typeStr, 60, 894);
ctx.font = '29px Stone Serif';
ctx.font = this.client.fonts.get('Stone Serif.ttf').toCanvasString(29);
ctx.fillText(atk.padStart(4, ' '), 514, 1079);
if (monsterType === 'link') ctx.fillText(def, 722, 1079);
else ctx.fillText(def.padStart(4, ' '), 675, 1079);
} else if (type === 'spell') {
ctx.font = '35px Stone Serif Small Caps';
ctx.font = this.client.fonts.get('Stone Serif Small Caps.ttf').toCanvasString(35);
ctx.fillText('[ Spell Card ]', 479, 141);
} else if (type === 'trap') {
ctx.font = '35px Stone Serif Small Caps';
ctx.font = this.client.fonts.get('Stone Serif Small Caps.ttf').toCanvasString(35);
ctx.fillText('[ Trap Card ]', 489, 141);
}
ctx.font = monsterType === 'normal' ? '27px Stone Serif LT Italic' : '27px Matrix Book';
const font = monsterType === 'normal' ? 'Stone Serif LT Italic.ttf' : 'Matrix Book.ttf';
ctx.font = this.client.fonts.get(font).toCanvasString(27);
const wrappedEffect = await wrapText(ctx, effect, 690);
const trimmed = wrappedEffect.slice(0, type === 'monster' ? 4 : 6);
ctx.fillText(trimmed.join('\n'), 63, 933 - (type === 'monster' ? 0 : 34));
ctx.font = '22px Stone Serif';
ctx.font = this.client.fonts.get('Stone Serif.ttf').toCanvasString(22);
ctx.fillStyle = monsterType === 'xyz' ? 'white' : 'black';
ctx.fillText(id.toString().padStart(8, '0'), 43, 1128);
ctx.fillText(`XIAO-EN${setID.toString().padStart(3, '0')}`, 589 - (monsterType === 'link' ? 58 : 0), 849);
+2 -3
View File
@@ -1,8 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'megaman_zero_dialog.ttf'), { family: 'MM Zero' });
module.exports = class ZeroDialogueCommand extends Command {
constructor(client) {
@@ -59,7 +58,7 @@ module.exports = class ZeroDialogueCommand extends Command {
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.font = '42px MM Zero';
ctx.font = this.client.fonts.get('megaman_zero_dialog.ttf').toCanvasString(42);
ctx.fillStyle = 'white';
ctx.textBaseline = 'top';
let text = await wrapText(ctx, quote, 425);
+2 -3
View File
@@ -1,8 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'SF-Pro-Display-Medium.otf'), { family: 'SF Pro' });
module.exports = class AlertCommand extends Command {
constructor(client) {
@@ -48,7 +47,7 @@ module.exports = class AlertCommand extends Command {
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.font = '30px SF Pro';
ctx.font = this.client.fonts.get('SF-Pro-Display-Medium.otf').toCanvasString(30);
ctx.fillStyle = '#1f1f1f';
ctx.textBaseline = 'top';
let text = await wrapText(ctx, message, 540);
+2 -3
View File
@@ -1,8 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { shortenText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'akbar.ttf'), { family: 'Akbar' });
module.exports = class LisaPresentationCommand extends Command {
constructor(client) {
@@ -48,7 +47,7 @@ module.exports = class LisaPresentationCommand extends Command {
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.textBaseline = 'top';
ctx.font = '19px Akbar';
ctx.font = this.client.fonts.get('akbar.ttf').toCanvasString(19);
ctx.fillStyle = 'white';
const shortened = shortenText(ctx, text.toUpperCase(), 500);
const arr = [];
+2 -3
View File
@@ -1,10 +1,9 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const { stripIndents } = require('common-tags');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
const texts = require('../../assets/json/be-like-bill');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'arialbd.ttf'), { family: 'Arial', weight: 'bold' });
module.exports = class BeLikeBillCommand extends Command {
constructor(client) {
@@ -50,7 +49,7 @@ module.exports = class BeLikeBillCommand extends Command {
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.font = 'normal bold 23px Arial';
ctx.font = this.client.fonts.get('arialbd.ttf').toCanvasString(23);
const text = await wrapText(ctx, texts[Math.floor(Math.random() * texts.length)].replaceAll('{{name}}', name), 569);
ctx.fillText(stripIndents`
This is ${name}.
+3 -6
View File
@@ -1,9 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class BoardroomMeetingCommand extends Command {
constructor(client) {
@@ -70,9 +67,9 @@ module.exports = class BoardroomMeetingCommand extends Command {
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.textBaseline = 'top';
ctx.font = '25px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(25);
ctx.fillText(question, 153, 8, 300);
ctx.font = '15px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(15);
ctx.fillText(suggestion1, 30, 251, 90);
ctx.fillText(suggestion2, 167, 258, 75);
ctx.fillText(final, 310, 269, 130);
+2 -5
View File
@@ -1,10 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { delay } = require('../../util/Util');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class CatchCommand extends Command {
constructor(client) {
@@ -53,7 +50,7 @@ module.exports = class CatchCommand extends Command {
ctx.drawImage(base, 0, 0);
ctx.textBaseline = 'top';
ctx.fillStyle = 'red';
ctx.font = '25px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(25);
ctx.fillText('EVERYONE CAUGHT IS', 18, 165);
ctx.textAlign = 'center';
ctx.fillText(is.toUpperCase(), 163, 202);
+3 -6
View File
@@ -1,10 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class ChangeMyMindCommand extends Command {
constructor(client) {
@@ -51,11 +48,11 @@ module.exports = class ChangeMyMindCommand extends Command {
ctx.textBaseline = 'top';
ctx.drawImage(base, 0, 0);
ctx.rotate(-24 * (Math.PI / 180));
ctx.font = '35px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(35);
let fontSize = 35;
while (ctx.measureText(text).width > 843) {
fontSize--;
ctx.font = `${fontSize}px Noto`;
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize);
}
const lines = await wrapText(ctx, text, 337);
ctx.fillText(lines.join('\n'), 142, 430, 337);
+3 -4
View File
@@ -1,8 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'wildwordsroman.ttf'), { family: 'Wild Words' });
module.exports = class ChiIdeaCommand extends Command {
constructor(client) {
@@ -55,11 +54,11 @@ module.exports = class ChiIdeaCommand extends Command {
ctx.drawImage(base, 0, 0);
ctx.textAlign = 'center';
ctx.textBaseline = 'top';
ctx.font = '15px Wild Words';
ctx.font = this.client.fonts.get('wildwordsroman.ttf').toCanvasString(15);
let fontSize = 15;
while (ctx.measureText(text).width > 500) {
fontSize--;
ctx.font = `${fontSize}px Wild Words`;
ctx.font = this.client.fonts.get('wildwordsroman.ttf').toCanvasString(fontSize);
}
const lines = await wrapText(ctx, text, 83);
const topMost = 137 - (((fontSize * lines.length) / 2) + ((5 * (lines.length - 1)) / 2));
+3 -4
View File
@@ -1,8 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Oswald-SemiBold.ttf'), { family: 'Oswald' });
module.exports = class DearLiberalsCommand extends Command {
constructor(client) {
@@ -65,12 +64,12 @@ module.exports = class DearLiberalsCommand extends Command {
ctx.drawImage(base, 0, 0);
ctx.fillStyle = 'white';
ctx.textBaseline = 'top';
ctx.font = '20px Oswald SemiBold';
ctx.font = this.client.fonts.get('Oswald-SemiBold.ttf').toCanvasString(20);
ctx.rotate(12.30 * (Math.PI / 180));
ctx.fillText(`#${hashtag}`, 200, 210);
ctx.rotate(-12.30 * (Math.PI / 180));
ctx.fillStyle = '#002046';
ctx.font = '27px Oswald SemiBold';
ctx.font = this.client.fonts.get('Oswald-SemiBold.ttf').toCanvasString(27);
const blueLines = await wrapText(ctx, blueText, 270);
ctx.fillText(blueLines.join('\n'), 207, 90);
ctx.fillStyle = '#c31a41';
+3 -7
View File
@@ -1,11 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
const { shortenText, centerImagePart } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class DemotivationalCommand extends Command {
constructor(client) {
@@ -70,10 +66,10 @@ module.exports = class DemotivationalCommand extends Command {
ctx.fillRect(x, y, width, height);
ctx.drawImage(data, x, y, width, height);
ctx.textAlign = 'center';
ctx.font = '60px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(60);
ctx.fillStyle = 'aquamarine';
ctx.fillText(shortenText(ctx, title, 610), 375, 518);
ctx.font = '27px Noto';
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' }] });
+5 -8
View File
@@ -1,10 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class DrakepostingCommand extends Command {
constructor(client) {
@@ -58,11 +55,11 @@ module.exports = class DrakepostingCommand extends Command {
ctx.drawImage(base, 0, 0);
ctx.textAlign = 'center';
ctx.textBaseline = 'top';
ctx.font = '50px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(50);
let fontSize = 50;
while (ctx.measureText(nah).width > 3003) {
fontSize--;
ctx.font = `${fontSize}px Noto`;
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize);
}
const nahLines = await wrapText(ctx, nah, 462);
const nahTopMost = 256 - (((fontSize * nahLines.length) / 2) + ((10 * (nahLines.length - 1)) / 2));
@@ -70,11 +67,11 @@ module.exports = class DrakepostingCommand extends Command {
const height = nahTopMost + ((fontSize + 10) * i);
ctx.fillText(nahLines[i], 768, height);
}
ctx.font = '50px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(50);
fontSize = 50;
while (ctx.measureText(yeah).width > 3003) {
fontSize--;
ctx.font = `${fontSize}px Noto`;
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize);
}
const yeahLines = await wrapText(ctx, yeah, 462);
const yeahTopMost = 768 - (((fontSize * yeahLines.length) / 2) + ((10 * (yeahLines.length - 1)) / 2));
+3 -6
View File
@@ -1,10 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class EddFactsBookCommand extends Command {
constructor(client) {
@@ -51,11 +48,11 @@ module.exports = class EddFactsBookCommand extends Command {
ctx.textBaseline = 'top';
ctx.drawImage(base, 0, 0);
ctx.rotate(15 * (Math.PI / 180));
ctx.font = '30px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(30);
let fontSize = 30;
while (ctx.measureText(fact).width > 458) {
fontSize--;
ctx.font = `${fontSize}px Noto`;
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize);
}
const lines = await wrapText(ctx, fact, 183);
ctx.fillText(lines.join('\n'), 119, 306, 183);
+2 -5
View File
@@ -1,11 +1,8 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
const { centerImagePart } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class EnslavedCommand extends Command {
constructor(client) {
@@ -58,7 +55,7 @@ module.exports = class EnslavedCommand extends Command {
ctx.textBaseline = 'top';
ctx.textAlign = 'center';
ctx.fillStyle = 'white';
ctx.font = '50px Noto';
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' }] });
} catch (err) {
+3 -6
View File
@@ -1,10 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class GenieRulesCommand extends Command {
constructor(client) {
@@ -52,11 +49,11 @@ module.exports = class GenieRulesCommand extends Command {
ctx.drawImage(base, 0, 0);
ctx.textAlign = 'center';
ctx.textBaseline = 'top';
ctx.font = '40px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(40);
let fontSize = 40;
while (ctx.measureText(text).width > 1143) {
fontSize--;
ctx.font = `${fontSize}px Noto`;
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize);
}
const lines = await wrapText(ctx, text, 381);
const topMost = 580 - (((fontSize * lines.length) / 2) + ((20 * (lines.length - 1)) / 2));
+3 -6
View File
@@ -1,10 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
const coord = [[450, 129], [1200, 134], [450, 627], [1200, 627]];
module.exports = class GruPlanCommand extends Command {
@@ -70,12 +67,12 @@ module.exports = class GruPlanCommand extends Command {
ctx.textBaseline = 'top';
let i = 0;
for (const [x, y] of coord) {
ctx.font = '35px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(35);
const step = steps[i];
let fontSize = 35;
while (ctx.measureText(step).width > 1100) {
fontSize--;
ctx.font = `${fontSize}px Noto`;
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize);
}
const lines = await wrapText(ctx, step, 252);
ctx.fillText(lines.join('\n'), x, y);
@@ -1,10 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class IfThoseKidsCouldReadCommand extends Command {
constructor(client) {
@@ -50,11 +47,11 @@ module.exports = class IfThoseKidsCouldReadCommand extends Command {
ctx.drawImage(base, 0, 0);
ctx.textAlign = 'center';
ctx.textBaseline = 'top';
ctx.font = '40px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(40);
let fontSize = 40;
while (ctx.measureText(text).width > 560) {
fontSize--;
ctx.font = `${fontSize}px Noto`;
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize);
}
const lines = await wrapText(ctx, text, 160);
const topMost = 140 - (((fontSize * lines.length) / 2) + ((20 * (lines.length - 1)) / 2));
+3 -6
View File
@@ -1,10 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class LisaPresentationCommand extends Command {
constructor(client) {
@@ -51,11 +48,11 @@ module.exports = class LisaPresentationCommand extends Command {
ctx.drawImage(base, 0, 0);
ctx.textAlign = 'center';
ctx.textBaseline = 'top';
ctx.font = '40px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(40);
let fontSize = 40;
while (ctx.measureText(text).width > 1320) {
fontSize--;
ctx.font = `${fontSize}px Noto`;
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize);
}
const lines = await wrapText(ctx, text, 330);
const topMost = 185 - (((fontSize * lines.length) / 2) + ((20 * (lines.length - 1)) / 2));
+6 -9
View File
@@ -1,10 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class MarioBrosViewsCommand extends Command {
constructor(client) {
@@ -63,14 +60,14 @@ module.exports = class MarioBrosViewsCommand extends Command {
ctx.drawImage(base, 0, 0);
ctx.textBaseline = 'top';
ctx.textAlign = 'center';
ctx.font = '47px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(47);
ctx.fillText(thing, 420, 108, 180);
ctx.fillStyle = 'white';
ctx.font = '36px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(36);
let fontSize = 36;
while (ctx.measureText(mario).width > 800) {
fontSize--;
ctx.font = `${fontSize}px Noto`;
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize);
}
const marioLines = await wrapText(ctx, mario, 200);
const marioTopMost = 450 - (((fontSize * marioLines.length) / 2) + ((20 * (marioLines.length - 1)) / 2));
@@ -81,11 +78,11 @@ module.exports = class MarioBrosViewsCommand extends Command {
ctx.strokeText(marioLines[i], 205, height);
ctx.fillText(marioLines[i], 205, height);
}
ctx.font = '36px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(36);
fontSize = 36;
while (ctx.measureText(luigi).width > 800) {
fontSize--;
ctx.font = `${fontSize}px Noto`;
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize);
}
const luigiLines = await wrapText(ctx, luigi, 200);
const luigiTopMost = 450 - (((fontSize * luigiLines.length) / 2) + ((20 * (luigiLines.length - 1)) / 2));
+2 -4
View File
@@ -1,9 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Impact.ttf'), { family: 'Impact' });
module.exports = class MemeGenClassicCommand extends Command {
constructor(client) {
@@ -70,7 +68,7 @@ module.exports = class MemeGenClassicCommand extends Command {
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
const fontSize = Math.round(base.height / 10);
ctx.font = `${fontSize}px Impact`;
ctx.font = this.client.fonts.get('Impact.ttf').toCanvasString(fontSize);
ctx.fillStyle = 'white';
ctx.textAlign = 'center';
ctx.textBaseline = 'top';
+3 -7
View File
@@ -1,11 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class MemeGenModernCommand extends Command {
constructor(client) {
@@ -66,7 +62,7 @@ module.exports = class MemeGenModernCommand extends Command {
const base = await loadImage(body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.font = '40px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(40);
const lines = await wrapText(ctx, text, base.width - 10);
const lineBreakLen = text.split('\n').length;
const linesLen = (40 * lines.length)
@@ -75,7 +71,7 @@ module.exports = class MemeGenModernCommand extends Command {
+ (14 * (lineBreakLen - 1))
+ 14;
canvas.height += linesLen;
ctx.font = '40px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(40);
ctx.textBaseline = 'top';
ctx.fillStyle = 'white';
ctx.fillRect(0, 0, base.width, linesLen);
+2 -5
View File
@@ -1,11 +1,8 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
const { centerImagePart } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class MetamorphosisCommand extends Command {
constructor(client) {
@@ -62,7 +59,7 @@ module.exports = class MetamorphosisCommand extends Command {
const { x, y, width, height } = centerImagePart(data, 200, 200, 412, 257);
ctx.drawImage(data, x, y, width, height);
ctx.textBaseline = 'top';
ctx.font = '20px Noto';
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' }] });
} catch (err) {
+2 -5
View File
@@ -1,10 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { shortenText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class NewPasswordCommand extends Command {
constructor(client) {
@@ -49,7 +46,7 @@ module.exports = class NewPasswordCommand extends Command {
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.font = '60px Noto';
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' }] });
+2 -5
View File
@@ -1,11 +1,8 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
const { wrapText, greyscale, drawImageWithTint } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class NikeAdCommand extends Command {
constructor(client) {
@@ -70,7 +67,7 @@ module.exports = class NikeAdCommand extends Command {
const height = Math.round(width / ratio);
ctx.drawImage(base, (data.width / 2) - (width / 2), data.height - height, width, height);
const fontSize = Math.round(data.height / 25);
ctx.font = `${fontSize}px Noto`;
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize);
ctx.fillStyle = 'white';
ctx.textAlign = 'center';
const lines = await wrapText(ctx, `Believe in ${something}. Even if it means ${sacrifice}.`, data.width - 20);
+7 -10
View File
@@ -1,10 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class PanikKalmPanikCommand extends Command {
constructor(client) {
@@ -59,11 +56,11 @@ module.exports = class PanikKalmPanikCommand extends Command {
ctx.drawImage(base, 0, 0);
ctx.textAlign = 'center';
ctx.textBaseline = 'top';
ctx.font = '40px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(40);
let fontSize = 40;
while (ctx.measureText(panik).width > 1136) {
fontSize--;
ctx.font = `${fontSize}px Noto`;
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize);
}
const panikLines = await wrapText(ctx, panik, 284);
const panikTopMost = 130 - (((fontSize * panikLines.length) / 2) + ((10 * (panikLines.length - 1)) / 2));
@@ -71,11 +68,11 @@ module.exports = class PanikKalmPanikCommand extends Command {
const height = panikTopMost + ((fontSize + 10) * i);
ctx.fillText(panikLines[i], 150, height);
}
ctx.font = '40px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(40);
fontSize = 40;
while (ctx.measureText(kalm).width > 1136) {
fontSize--;
ctx.font = `${fontSize}px Noto`;
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize);
}
const kalmLines = await wrapText(ctx, kalm, 284);
const kalmTopMost = 430 - (((fontSize * kalmLines.length) / 2) + ((10 * (kalmLines.length - 1)) / 2));
@@ -83,11 +80,11 @@ module.exports = class PanikKalmPanikCommand extends Command {
const height = kalmTopMost + ((fontSize + 10) * i);
ctx.fillText(kalmLines[i], 150, height);
}
ctx.font = '40px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(40);
fontSize = 40;
while (ctx.measureText(panik2).width > 1136) {
fontSize--;
ctx.font = `${fontSize}px Noto`;
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize);
}
const panik2Lines = await wrapText(ctx, panik2, 284);
const panik2TopMost = 730 - (((fontSize * panik2Lines.length) / 2) + ((10 * (panik2Lines.length - 1)) / 2));
+3 -6
View File
@@ -1,9 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
const coord = [
[[136, 135], [416, 135]],
[[136, 328], [416, 328]],
@@ -82,13 +79,13 @@ module.exports = class PhoebeTeachingJoeyCommand extends Command {
for (const coords of coord) {
let j = 0;
for (const [x, y] of coords) {
ctx.font = '20px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(20);
let step = steps[i];
if (step === incorrect && j === 0) step = correct.join(' ');
let fontSize = 20;
while (ctx.measureText(step).width > 260) {
fontSize--;
ctx.font = `${fontSize}px Noto`;
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize);
}
ctx.strokeText(step, x, y, 260);
ctx.fillText(step, x, y, 260);
+3 -6
View File
@@ -1,10 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class PillsCommand extends Command {
constructor(client) {
@@ -45,11 +42,11 @@ module.exports = class PillsCommand extends Command {
ctx.drawImage(base, 0, 0);
ctx.textAlign = 'center';
ctx.textBaseline = 'top';
ctx.font = '32px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(32);
let fontSize = 32;
while (ctx.measureText(text).width > 1260) {
fontSize--;
ctx.font = `${fontSize}px Noto`;
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize);
}
const lines = await wrapText(ctx, text, 280);
const topMost = 455 - (((fontSize * lines.length) / 2) + ((10 * (lines.length - 1)) / 2));
+3 -6
View File
@@ -1,10 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
const coord = [[240, 63], [689, 63], [705, 383], [220, 380]];
module.exports = class PlanktonPlanCommand extends Command {
@@ -70,12 +67,12 @@ module.exports = class PlanktonPlanCommand extends Command {
ctx.textBaseline = 'top';
let i = 0;
for (const [x, y] of coord) {
ctx.font = '35px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(35);
const step = steps[i];
let fontSize = 35;
while (ctx.measureText(step).width > 420) {
fontSize--;
ctx.font = `${fontSize}px Noto`;
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize);
}
const lines = await wrapText(ctx, step, 155);
ctx.fillText(lines.join('\n'), x, y);
+3 -6
View File
@@ -1,10 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class ScrollOfTruthCommand extends Command {
constructor(client) {
@@ -51,11 +48,11 @@ module.exports = class ScrollOfTruthCommand extends Command {
ctx.drawImage(base, 0, 0);
ctx.textAlign = 'center';
ctx.textBaseline = 'top';
ctx.font = '60px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(60);
let fontSize = 60;
while (ctx.measureText(text).width > 542) {
fontSize--;
ctx.font = `${fontSize}px Noto`;
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize);
}
const lines = await wrapText(ctx, text, 217);
const topMost = 850 - (((fontSize * lines.length) / 2) + ((20 * (lines.length - 1)) / 2));
+2 -3
View File
@@ -1,8 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Futura Condensed.ttf'), { family: 'Futura' });
module.exports = class SkyrimSkillCommand extends Command {
constructor(client) {
@@ -60,7 +59,7 @@ module.exports = class SkyrimSkillCommand extends Command {
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0, plate.width, height);
ctx.drawImage(plate, 0, height + 1);
ctx.font = '77px Futura';
ctx.font = this.client.fonts.get('Futura Condensed.ttf').toCanvasString(77);
ctx.textAlign = 'center';
ctx.textBaseline = 'top';
ctx.fillStyle = 'black';
+3 -6
View File
@@ -1,10 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class SonicSaysCommand extends Command {
constructor(client) {
@@ -50,11 +47,11 @@ module.exports = class SonicSaysCommand extends Command {
const ctx = canvas.getContext('2d');
ctx.textBaseline = 'top';
ctx.drawImage(base, 0, 0);
ctx.font = '24px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(24);
let fontSize = 24;
while (ctx.measureText(text).width > 648) {
fontSize--;
ctx.font = `${fontSize}px Noto`;
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize);
}
const lines = await wrapText(ctx, text, 185);
ctx.fillStyle = 'white';
+3 -4
View File
@@ -1,7 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'SunDried.ttf'), { family: 'Sun Dried' });
module.exports = class SosCommand extends Command {
constructor(client) {
@@ -45,7 +44,7 @@ module.exports = class SosCommand extends Command {
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.font = '90px Sun Dried';
ctx.font = this.client.fonts.get('SunDried.ttf').toCanvasString(90);
ctx.fillStyle = 'black';
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
@@ -53,7 +52,7 @@ module.exports = class SosCommand extends Command {
let fontSize = 90;
while (ctx.measureText(message).width > 140) {
fontSize--;
ctx.font = `${fontSize}px Sun Dried`;
ctx.font = this.client.fonts.get('SunDried.ttf').toCanvasString(fontSize);
}
ctx.fillText(message.toUpperCase(), 362, 522);
ctx.rotate(-15 * (Math.PI / 180));
+5 -8
View File
@@ -1,10 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class SpidermanPointingCommand extends Command {
constructor(client) {
@@ -57,12 +54,12 @@ module.exports = class SpidermanPointingCommand extends Command {
ctx.drawImage(base, 0, 0);
ctx.textAlign = 'center';
ctx.textBaseline = 'top';
ctx.font = '50px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(50);
ctx.fillStyle = 'white';
let fontSize = 50;
while (ctx.measureText(first).width > 725) {
fontSize--;
ctx.font = `${fontSize}px Noto`;
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize);
}
const lines = await wrapText(ctx, first, 290);
const topMost = 189 - (((fontSize * lines.length) / 2) + ((10 * (lines.length - 1)) / 2));
@@ -73,11 +70,11 @@ module.exports = class SpidermanPointingCommand extends Command {
ctx.strokeText(lines[i], 222, height);
ctx.fillText(lines[i], 222, height);
}
ctx.font = '50px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(50);
fontSize = 50;
while (ctx.measureText(second).width > 725) {
fontSize--;
ctx.font = `${fontSize}px Noto`;
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize);
}
const lines2 = await wrapText(ctx, second, 290);
const topMost2 = 190 - (((fontSize * lines2.length) / 2) + ((10 * (lines2.length - 1)) / 2));
+5 -8
View File
@@ -1,10 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class SpongebobBurnCommand extends Command {
constructor(client) {
@@ -58,17 +55,17 @@ module.exports = class SpongebobBurnCommand extends Command {
ctx.drawImage(base, 0, 0);
ctx.fillStyle = 'black';
ctx.textBaseline = 'top';
ctx.font = '35px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(35);
let fontSize = 35;
while (ctx.measureText(burn).width > 400) {
fontSize--;
ctx.font = `${fontSize}px Noto`;
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize);
}
const lines = await wrapText(ctx, burn, 180);
ctx.fillText(lines.join('\n'), 55, 103);
ctx.font = '25px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(25);
ctx.fillText(person, 382, 26);
ctx.font = '20px Noto';
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' }] });
+5 -6
View File
@@ -1,8 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'TragicMarker.otf'), { family: 'Tragic Marker' });
module.exports = class ThatSignWontStopMeCommand extends Command {
constructor(client) {
@@ -49,11 +48,11 @@ module.exports = class ThatSignWontStopMeCommand extends Command {
ctx.drawImage(base, 0, 0);
ctx.textAlign = 'center';
ctx.textBaseline = 'top';
ctx.font = '62px Tragic Marker';
ctx.font = this.client.fonts.get('TragicMarker.otf').toCanvasString(62);
let fontSize = 62;
while (ctx.measureText(text).width > 1002) {
fontSize--;
ctx.font = `${fontSize}px Tragic Marker`;
ctx.font = this.client.fonts.get('TragicMarker.otf').toCanvasString(fontSize);
}
const lines = await wrapText(ctx, text, 334);
const topMost = 240 - (((fontSize * lines.length) / 2) + ((10 * (lines.length - 1)) / 2));
@@ -61,11 +60,11 @@ module.exports = class ThatSignWontStopMeCommand extends Command {
const height = topMost + ((fontSize + 10) * i);
ctx.fillText(lines[i], 210, height);
}
ctx.font = '16px Tragic Marker';
ctx.font = this.client.fonts.get('TragicMarker.otf').toCanvasString(16);
fontSize = 16;
while (ctx.measureText(text).width > 264) {
fontSize--;
ctx.font = `${fontSize}px Tragic Marker`;
ctx.font = this.client.fonts.get('TragicMarker.otf').toCanvasString(fontSize);
}
const bLines = await wrapText(ctx, text, 88);
const bTopMost = 645 - (((fontSize * bLines.length) / 2) + ((2 * (bLines.length - 1)) / 2));
+5 -8
View File
@@ -1,10 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class TuxedoPoohCommand extends Command {
constructor(client) {
@@ -58,11 +55,11 @@ module.exports = class TuxedoPoohCommand extends Command {
ctx.drawImage(base, 0, 0);
ctx.textAlign = 'center';
ctx.textBaseline = 'top';
ctx.font = '50px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(50);
let fontSize = 50;
while (ctx.measureText(normal).width > 1320) {
fontSize--;
ctx.font = `${fontSize}px Noto`;
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize);
}
const normalLines = await wrapText(ctx, normal, 440);
const normalTopMost = 145 - (((fontSize * normalLines.length) / 2) + ((10 * (normalLines.length - 1)) / 2));
@@ -70,11 +67,11 @@ module.exports = class TuxedoPoohCommand extends Command {
const height = normalTopMost + ((fontSize + 10) * i);
ctx.fillText(normalLines[i], 570, height);
}
ctx.font = '50px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(50);
fontSize = 50;
while (ctx.measureText(tuxedo).width > 1320) {
fontSize--;
ctx.font = `${fontSize}px Noto`;
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize);
}
const tuxedoLines = await wrapText(ctx, tuxedo, 440);
const tuxedoTopMost = 436 - (((fontSize * tuxedoLines.length) / 2) + ((10 * (tuxedoLines.length - 1)) / 2));
+5 -8
View File
@@ -1,10 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class TwoButtonsCommand extends Command {
constructor(client) {
@@ -57,11 +54,11 @@ module.exports = class TwoButtonsCommand extends Command {
ctx.textBaseline = 'top';
ctx.drawImage(base, 0, 0);
ctx.rotate(-12 * (Math.PI / 180));
ctx.font = '34px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(34);
let fontSize = 34;
while (ctx.measureText(first).width > 366) {
fontSize--;
ctx.font = `${fontSize}px Noto`;
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize);
}
const firstLines = await wrapText(ctx, first, 183);
let lineOffset = 0;
@@ -69,11 +66,11 @@ module.exports = class TwoButtonsCommand extends Command {
ctx.fillText(firstLines[i], 25 + lineOffset, 116 + (fontSize * i) + (10 * i), 183);
lineOffset += 5;
}
ctx.font = '34px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(34);
fontSize = 34;
while (ctx.measureText(second).width > 244) {
fontSize--;
ctx.font = `${fontSize}px Noto`;
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize);
}
const secondLines = await wrapText(ctx, second, 118);
lineOffset = 0;
+2 -4
View File
@@ -1,8 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, registerFont } = require('canvas');
const path = require('path');
const { createCanvas } = require('canvas');
const pool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ23456789'.split('');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Captcha.ttf'), { family: 'Captcha' });
module.exports = class CaptchaCommand extends Command {
constructor(client) {
@@ -36,7 +34,7 @@ module.exports = class CaptchaCommand extends Command {
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.beginPath();
ctx.strokeStyle = '#0088cc';
ctx.font = '26px Captcha';
ctx.font = this.client.fonts.get('Captcha.ttf').toCanvasString(26);
ctx.rotate(-0.05);
ctx.strokeText(text, 15, 26);
await msg.reply(
+3 -4
View File
@@ -1,11 +1,10 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { stripIndents } = require('common-tags');
const { shuffle, randomRange, formatTime } = require('../../util/Util');
const { drawImageWithTint } = require('../../util/Canvas');
const horses = require('../../assets/json/horse-race');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Paladins.otf'), { family: 'Paladins' });
const colors = ['gold', 'silver', '#cd7f32'];
module.exports = class HorseRaceCommand extends Command {
@@ -101,9 +100,9 @@ module.exports = class HorseRaceCommand extends Command {
const result = results[i];
const horse = chosenHorses.find(hor => hor.name === result.name);
if (colors[i]) drawImageWithTint(ctx, horseImg, colors[i], 37, 114 + (49 * i), 49, 49);
ctx.font = '34px Paladins';
ctx.font = this.client.fonts.get('Paladins.otf').toCanvasString(34);
ctx.fillText(formatTime(result.time), 755, 138 + (49 * i));
ctx.font = '15px Paladins';
ctx.font = this.client.fonts.get('Paladins.otf').toCanvasString(15);
ctx.fillText(horse.name, 251, 138 + (49 * i));
}
return { attachment: canvas.toBuffer(), name: 'leaderboard.png' };
+2 -3
View File
@@ -1,10 +1,9 @@
const Command = require('../../structures/Command');
const request = require('node-superfetch');
const { createCanvas, registerFont } = require('canvas');
const { createCanvas } = require('canvas');
const path = require('path');
const { reactIfAble } = require('../../util/Util');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'OPTIKorinna-Agency.otf'), { family: 'Korinna' });
module.exports = class JeopardyCommand extends Command {
constructor(client) {
@@ -97,7 +96,7 @@ module.exports = class JeopardyCommand extends Command {
ctx.textAlign = 'center';
ctx.textBaseline = 'top';
ctx.fillStyle = 'white';
ctx.font = '62px Korinna';
ctx.font = this.client.fonts.get('OPTIKorinna-Agency.otf').toCanvasString(62);
const lines = await wrapText(ctx, question.toUpperCase(), 813);
const topMost = (canvas.height / 2) - (((52 * lines.length) / 2) + ((20 * (lines.length - 1)) / 2));
for (let i = 0; i < lines.length; i++) {
+2 -3
View File
@@ -1,11 +1,10 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const { stripIndents } = require('common-tags');
const { greyscale } = require('../../util/Canvas');
const path = require('path');
const advantages = require('../../assets/json/pokemon-advantage');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Pokemon Solid.ttf'), { family: 'Pokemon' });
module.exports = class PokemonAdvantageCommand extends Command {
constructor(client) {
@@ -144,7 +143,7 @@ module.exports = class PokemonAdvantageCommand extends Command {
ctx.drawImage(pkmn1, 41, 12, 175, 175);
ctx.drawImage(pkmn2, 261, 12, 175, 175);
}
ctx.font = '30px Pokemon';
ctx.font = this.client.fonts.get('Pokemon Solid.ttf').toCanvasString(30);
ctx.textAlign = 'center';
ctx.textBaseline = 'bottom';
ctx.lineWidth = 8;
+2 -4
View File
@@ -1,11 +1,9 @@
const Command = require('../../structures/Command');
const { createCanvas, registerFont } = require('canvas');
const { createCanvas } = require('canvas');
const { stripIndents } = require('common-tags');
const Diff = require('text-diff');
const path = require('path');
const { fetchHSUserDisplay } = require('../../util/Util');
const words = require('../../assets/json/word-list');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
module.exports = class TypingTestCommand extends Command {
constructor(client) {
@@ -73,7 +71,7 @@ module.exports = class TypingTestCommand extends Command {
const len = ctxPre.measureText(sentence);
const canvas = createCanvas(100 + len.width, 200);
const ctx = canvas.getContext('2d');
ctx.font = '75px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(75);
ctx.textBaseline = 'middle';
ctx.textAlign = 'center';
ctx.fillStyle = 'white';
+2 -3
View File
@@ -1,10 +1,9 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const { reactIfAble } = require('../../util/Util');
const { silhouette } = require('../../util/Canvas');
const path = require('path');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Pokemon Solid.ttf'), { family: 'Pokemon' });
module.exports = class WhosThatPokemonCommand extends Command {
constructor(client) {
@@ -141,7 +140,7 @@ module.exports = class WhosThatPokemonCommand extends Command {
ctx.drawImage(silhouetteCanvas, 30, 39, 200, 200);
} else {
ctx.drawImage(pkmn, 30, 39, 200, 200);
ctx.font = '60px Pokemon';
ctx.font = this.client.fonts.get('Pokemon Solid.ttf').toCanvasString(60);
ctx.textAlign = 'center';
ctx.textBaseline = 'bottom';
ctx.lineWidth = 8;
+4 -5
View File
@@ -1,11 +1,10 @@
const Command = require('../../structures/Command');
const { MersenneTwister19937, integer } = require('random-js');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
const { percentColor } = require('../../util/Util');
const { GIRLFRIEND_USER_ID } = process.env;
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Pinky Cupid.otf'), { family: 'Pinky Cupid' });
const percentColors = [
{ pct: 0.0, color: { r: 0, g: 0, b: 255 } },
{ pct: 0.5, color: { r: 0, g: 255 / 2, b: 255 / 2 } },
@@ -86,16 +85,16 @@ module.exports = class FriendshipCommand extends Command {
ctx.textAlign = 'center';
ctx.textBaseline = 'top';
ctx.fillStyle = 'green';
ctx.font = '40px Pinky Cupid';
ctx.font = this.client.fonts.get('Pinky Cupid.otf').toCanvasString(40);
ctx.fillText('~Xiao\'s Friendship Meter~', 600, 15);
ctx.fillStyle = 'white';
ctx.fillText(first.username, 270, 448);
ctx.fillText(second.username, 930, 448);
ctx.font = '60px Pinky Cupid';
ctx.font = this.client.fonts.get('Pinky Cupid.otf').toCanvasString(60);
ctx.fillStyle = percentColor(level / 100, percentColors);
ctx.fillText(`~${level}%~`, 600, 230);
ctx.fillText(this.calculateLevelText(level, self, owner, authorUser, botUser), 600, 296);
ctx.font = '90px Pinky Cupid';
ctx.font = this.client.fonts.get('Pinky Cupid.otf').toCanvasString(90);
ctx.fillText(level > 49 ? '👍' : '👎', 600, 100);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'friendship.png' }] });
} catch (err) {
+4 -5
View File
@@ -1,11 +1,10 @@
const Command = require('../../structures/Command');
const { MersenneTwister19937, integer } = require('random-js');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
const { percentColor } = require('../../util/Util');
const { GIRLFRIEND_USER_ID } = process.env;
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Pinky Cupid.otf'), { family: 'Pinky Cupid' });
const percentColors = [
{ pct: 0.0, color: { r: 0, g: 0, b: 255 } },
{ pct: 0.5, color: { r: 255 / 2, g: 0, b: 255 / 2 } },
@@ -85,16 +84,16 @@ module.exports = class ShipCommand extends Command {
ctx.textAlign = 'center';
ctx.textBaseline = 'top';
ctx.fillStyle = '#ff6c6c';
ctx.font = '40px Pinky Cupid';
ctx.font = this.client.fonts.get('Pinky Cupid.otf').toCanvasString(40);
ctx.fillText('~Xiao\'s Compatability Meter~', 600, 15);
ctx.fillStyle = 'white';
ctx.fillText(first.username, 270, 448);
ctx.fillText(second.username, 930, 448);
ctx.font = '60px Pinky Cupid';
ctx.font = this.client.fonts.get('Pinky Cupid.otf').toCanvasString(60);
ctx.fillStyle = percentColor(level / 100, percentColors);
ctx.fillText(`~${level}%~`, 600, 230);
ctx.fillText(this.calculateLevelText(level, self, owner, authorUser, botUser), 600, 296);
ctx.font = '90px Pinky Cupid';
ctx.font = this.client.fonts.get('Pinky Cupid.otf').toCanvasString(90);
ctx.fillText(level > 49 ? '❤️' : '💔', 600, 100);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'ship.png' }] });
} catch (err) {
+4 -5
View File
@@ -1,8 +1,7 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const { createCanvas, loadImage } = require('canvas');
const path = require('path');
const { elements, colors } = require('../../assets/json/periodic-table');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
module.exports = class PeriodicTableCommand extends Command {
constructor(client) {
@@ -66,15 +65,15 @@ module.exports = class PeriodicTableCommand extends Command {
const batman = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'batman.png'));
ctx.drawImage(batman, 100, 166);
} else {
ctx.font = '210px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(210);
ctx.fillStyle = colors[element.phase] || 'gray';
ctx.fillText(element.symbol, 250, 320);
}
ctx.fillStyle = 'black';
ctx.font = '45px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(45);
ctx.fillText(element.number, 250, 100);
ctx.fillText(element.name, 250, 450);
ctx.font = '30px Noto';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(30);
ctx.fillText(element.mass || '?', 250, 400);
const period = element.number === 0 ? element.period : `period ${element.period}`;
const phase = element.undiscovered ? `hypothetical ${element.phase || 'element'}` : element.phase;