mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-24 22:34:46 +02:00
The result is the exact same but worse
This commit is contained in:
@@ -1,13 +1,10 @@
|
|||||||
const Command = require('../../structures/Command');
|
const Command = require('../../structures/Command');
|
||||||
const { createCanvas, loadImage, registerFont } = require('canvas');
|
const { createCanvas, loadImage, registerFont } = require('canvas');
|
||||||
const { default: drawText } = require('node-canvas-text');
|
|
||||||
const GIFEncoder = require('gifencoder');
|
const GIFEncoder = require('gifencoder');
|
||||||
const opentype = require('opentype.js');
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const { streamToArray } = require('../../util/Util');
|
const { streamToArray } = require('../../util/Util');
|
||||||
const frames = require('../../assets/json/illegal');
|
const frames = require('../../assets/json/illegal');
|
||||||
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Impact.ttf'), { family: 'Impact' });
|
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Impact.ttf'), { family: 'Impact' });
|
||||||
const impactFont = opentype.loadSync(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Impact.ttf'));
|
|
||||||
|
|
||||||
module.exports = class IllegalCommand extends Command {
|
module.exports = class IllegalCommand extends Command {
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
@@ -79,19 +76,8 @@ module.exports = class IllegalCommand extends Command {
|
|||||||
}
|
}
|
||||||
ctx.textBaseline = 'top';
|
ctx.textBaseline = 'top';
|
||||||
ctx.font = '20px Impact';
|
ctx.font = '20px Impact';
|
||||||
const rect = {
|
const maxLen = frame.corners[1][0] - frame.corners[0][0];
|
||||||
x: frame.corners[0][0],
|
ctx.fillText(`${text}\n${verb} NOW\nILLEGAL`, frame.corners[0][0], frame.corners[0][1], maxLen);
|
||||||
y: frame.corners[0][1],
|
|
||||||
width: frame.corners[1][0] - frame.corners[0][0],
|
|
||||||
height: frame.corners[2][1] - frame.corners[0][1]
|
|
||||||
};
|
|
||||||
drawText(ctx, `${text}\n${verb} NOW\nILLEGAL`, impactFont, rect, {
|
|
||||||
minSize: 5,
|
|
||||||
maxSize: 20,
|
|
||||||
hAlign: 'center',
|
|
||||||
wAlign: 'center',
|
|
||||||
textPadding: 5
|
|
||||||
});
|
|
||||||
encoder.addFrame(ctx);
|
encoder.addFrame(ctx);
|
||||||
}
|
}
|
||||||
encoder.finish();
|
encoder.finish();
|
||||||
|
|||||||
@@ -53,9 +53,7 @@
|
|||||||
"moment": "^2.29.1",
|
"moment": "^2.29.1",
|
||||||
"moment-duration-format": "^2.3.2",
|
"moment-duration-format": "^2.3.2",
|
||||||
"moment-timezone": "^0.5.31",
|
"moment-timezone": "^0.5.31",
|
||||||
"node-canvas-text": "^1.0.2",
|
|
||||||
"node-superfetch": "^0.1.10",
|
"node-superfetch": "^0.1.10",
|
||||||
"opentype.js": "^1.3.3",
|
|
||||||
"pokersolver": "^2.1.4",
|
"pokersolver": "^2.1.4",
|
||||||
"random-js": "^2.1.0",
|
"random-js": "^2.1.0",
|
||||||
"rss-parser": "^3.9.0",
|
"rss-parser": "^3.9.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user