Visual Center Doesn't work :(

This commit is contained in:
Dragon Fire
2021-03-27 16:49:40 -04:00
parent 9c8847bd2a
commit 4722d72fa5
2 changed files with 1 additions and 14 deletions
+1 -13
View File
@@ -1,7 +1,6 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const visualCenter = require('visual-center');
module.exports = class SnapchatCommand extends Command {
constructor(client) {
@@ -56,9 +55,7 @@ module.exports = class SnapchatCommand extends Command {
ctx.textBaseline = 'top';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(base.height / 24);
const barHeight = (base.height / 24) * 2;
const { visualTop } = await this.visualCenter(body);
const moveCenter = visualTop > 0.5 ? 1 - visualTop - 0.5 : visualTop < 0.5 ? 1 + (visualTop - 0.5) : 1;
const barPosition = base.height - (base.height * moveCenter);
const barPosition = base.height - (base.height / 3);
ctx.globalAlpha = 0.3;
ctx.fillStyle = 'black';
ctx.fillRect(0, barPosition - barHeight, base.width, barHeight);
@@ -66,13 +63,4 @@ module.exports = class SnapchatCommand extends Command {
ctx.fillText(text, base.width / 2, (barPosition - barHeight) * 0.4);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'snapchat.png' }] });
}
visualCenter(image) {
return new Promise((res, rej) => {
visualCenter(image.toString('base64'), (err, data) => {
if (err) return rej(err);
return res(data);
});
});
}
};
-1
View File
@@ -79,7 +79,6 @@
"tictactoe-minimax-ai": "^1.2.1",
"user-agents": "^1.0.602",
"valid-url": "^1.0.9",
"visual-center": "^0.1.1",
"wavefile": "^11.0.0",
"winston": "^3.3.3",
"ytdl-core": "^4.5.0"