From d73fcffd9c0f1c2f37341a10aa22a1a51f7fb90d Mon Sep 17 00:00:00 2001 From: loicbersier Date: Fri, 21 Feb 2020 21:28:02 +0100 Subject: [PATCH] use imagemagick --- commands/images/meme.js | 6 +++--- commands/images/poster.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/commands/images/meme.js b/commands/images/meme.js index e50985bb..138332b8 100644 --- a/commands/images/meme.js +++ b/commands/images/meme.js @@ -1,5 +1,5 @@ const { Command } = require('discord-akairo'); -let gm = require('gm'); +const gm = require('gm').subClass({imageMagick: true}); const os = require('os'); const fetch = require('node-fetch'); const fs = require('fs'); @@ -60,11 +60,11 @@ class memeCommand extends Command { // Create new graphicsmagick instance fetch(url) .then(res => { - const dest = fs.createWriteStream(`${os.tmpdir()}/${message.id}.${url.split('.').pop()}`); + const dest = fs.createWriteStream(`${os.tmpdir()}/${message.id}`); res.body.pipe(dest); dest.on('finish', async () => { - let img = gm(`${os.tmpdir()}/${message.id}.${url.split('.').pop()}`); + let img = gm(`${os.tmpdir()}/${message.id}`); // Set some defaults const TOP_TEXT = options[0]; diff --git a/commands/images/poster.js b/commands/images/poster.js index 19e20c5e..dd2283b6 100644 --- a/commands/images/poster.js +++ b/commands/images/poster.js @@ -1,5 +1,5 @@ const { Command } = require('discord-akairo'); -let gm = require('gm'); +const gm = require('gm').subClass({imageMagick: true}); const os = require('os'); const fetch = require('node-fetch'); const fs = require('fs'); @@ -77,11 +77,11 @@ class posterCommand extends Command { // Create new graphicsmagick instance fetch(url) .then(res => { - const dest = fs.createWriteStream(`${os.tmpdir()}/${message.id}.${url.split('.').pop()}`); + const dest = fs.createWriteStream(`${os.tmpdir()}/${message.id}`); res.body.pipe(dest); dest.on('finish', async () => { - let img = gm(`${os.tmpdir()}/${message.id}.${url.split('.').pop()}`); + let img = gm(`${os.tmpdir()}/${message.id}`); // Set some defaults const TOP_TEXT = options[0]; const BOTTOM_TEXT = options[1];