From 411eb541e5b19e591d29f758c77a9b984ccdb69f Mon Sep 17 00:00:00 2001 From: loicbersier Date: Wed, 19 Feb 2020 13:42:39 +0100 Subject: [PATCH] Make font have better size --- commands/images/meme.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/commands/images/meme.js b/commands/images/meme.js index b2a3f643..8d3ba85a 100644 --- a/commands/images/meme.js +++ b/commands/images/meme.js @@ -45,12 +45,8 @@ class memeCommand extends Command { else if (options[1] == undefined) options[1] = ''; - let Attachment = (message.attachments).array(); let url = args.link; - // Get attachment link - if (Attachment[0] && !args.link) { - url = Attachment[0].url; - } + if (!url) { return message.channel.send('You need an image to use this command!'); @@ -71,7 +67,6 @@ class memeCommand extends Command { const TOP_TEXT = options[0]; const BOTTOM_TEXT = options[1]; const FONT = './asset/impact.ttf'; - const FONT_SIZE = 40; const FONT_FILL = '#FFF'; const TEXT_POS = 'center'; const STROKE_COLOR = '#000'; @@ -84,6 +79,7 @@ class memeCommand extends Command { // Set text position for top and bottom const TOP_POS = Math.abs((value.height / 2) - PADDING) * -1; const BOTTOM_POS = (value.height / 2) - PADDING; + const FONT_SIZE = (value.width / 10); // Write text on image using graphicsmagick img.font(FONT, FONT_SIZE)