mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-15 00:12:38 +02:00
Swap all files to new font system
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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' }] });
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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++) {
|
||||
|
||||
@@ -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' }] });
|
||||
}
|
||||
|
||||
@@ -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' }] });
|
||||
|
||||
@@ -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++) {
|
||||
|
||||
@@ -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' }] });
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user