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