From 2a857938afa878fdbc366a01ec47021cf3964c0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Bersier?= Date: Fri, 14 Jun 2019 18:32:37 +0200 Subject: [PATCH] Change the way it shows text --- commands/images/meme.js | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/commands/images/meme.js b/commands/images/meme.js index 09c8f5ec..e575469c 100644 --- a/commands/images/meme.js +++ b/commands/images/meme.js @@ -41,20 +41,34 @@ class memeCommand extends Command { processGif(); }); }); - } else if (Attachment[0] && Attachment[0].url.endsWith('gif')) { + } else if (Attachment[0]) { fs.writeFile('./img/memeInput.gif', Attachment[0], 'binary', function(err) { if (err) throw err; processGif(); }); } else { - return message.channel.send('Please use a gif!'); + return message.channel.send('Please use an image!'); } function processGif() { gm('./img/memeInput.gif') + .stroke('#000000', 0.1) .fill('#ffffff') - .font('/usr/share/fonts/TTF/impact.ttf') - .drawText(0, 20, args.topText, 'North') + /* + // I have to try to make this work so font can adapt with image + .size(function(err, size) { + if (err) throw err; + if (size.width < 300 ) { + console.log('ye'); + this.pointSize(10); + } else { + console.log('nah'); + this.pointSize(50); + } + }) + */ + .font('/usr/share/fonts/TTF/impact.ttf', 40) + .drawText(0, 30, args.topText, 'North') .drawText(0, 10, args.bottomText, 'South') .write('./img/meme.gif', function (err) { if (!err) {