mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Make emoji cleaner
This commit is contained in:
@@ -40,10 +40,6 @@ module.exports = class EmojiFaceCommand extends Command {
|
||||
}
|
||||
const emojiData = await request.get(emojiURL);
|
||||
const emojiImg = await loadImage(emojiData.body);
|
||||
if (emojiURL.endsWith('svg')) {
|
||||
emojiImg.width *= 4;
|
||||
emojiImg.height *= 4;
|
||||
}
|
||||
const imgData = await request.get(image);
|
||||
const faces = await this.client.detectFaces(imgData.body);
|
||||
if (!faces) return msg.reply('There are no faces in this image.');
|
||||
@@ -55,6 +51,10 @@ module.exports = class EmojiFaceCommand extends Command {
|
||||
for (const face of faces) {
|
||||
const ratio = face.box.width / emojiImg.width;
|
||||
const height = emojiImg.height * ratio;
|
||||
if (emojiURL.endsWith('svg')) {
|
||||
emojiImg.width = face.box.width * 1.4;
|
||||
emojiImg.height = height * 1.4;
|
||||
}
|
||||
ctx.drawImage(
|
||||
emojiImg,
|
||||
face.box.xMin - (face.box.width * 0.2),
|
||||
|
||||
Reference in New Issue
Block a user