use imagemagick
This commit is contained in:
parent
863cb2c25f
commit
d73fcffd9c
2 changed files with 6 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
||||||
const { Command } = require('discord-akairo');
|
const { Command } = require('discord-akairo');
|
||||||
let gm = require('gm');
|
const gm = require('gm').subClass({imageMagick: true});
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
const fetch = require('node-fetch');
|
const fetch = require('node-fetch');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
@ -60,11 +60,11 @@ class memeCommand extends Command {
|
||||||
// Create new graphicsmagick instance
|
// Create new graphicsmagick instance
|
||||||
fetch(url)
|
fetch(url)
|
||||||
.then(res => {
|
.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);
|
res.body.pipe(dest);
|
||||||
dest.on('finish', async () => {
|
dest.on('finish', async () => {
|
||||||
|
|
||||||
let img = gm(`${os.tmpdir()}/${message.id}.${url.split('.').pop()}`);
|
let img = gm(`${os.tmpdir()}/${message.id}`);
|
||||||
|
|
||||||
// Set some defaults
|
// Set some defaults
|
||||||
const TOP_TEXT = options[0];
|
const TOP_TEXT = options[0];
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
const { Command } = require('discord-akairo');
|
const { Command } = require('discord-akairo');
|
||||||
let gm = require('gm');
|
const gm = require('gm').subClass({imageMagick: true});
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
const fetch = require('node-fetch');
|
const fetch = require('node-fetch');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
@ -77,11 +77,11 @@ class posterCommand extends Command {
|
||||||
// Create new graphicsmagick instance
|
// Create new graphicsmagick instance
|
||||||
fetch(url)
|
fetch(url)
|
||||||
.then(res => {
|
.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);
|
res.body.pipe(dest);
|
||||||
dest.on('finish', async () => {
|
dest.on('finish', async () => {
|
||||||
|
|
||||||
let img = gm(`${os.tmpdir()}/${message.id}.${url.split('.').pop()}`);
|
let img = gm(`${os.tmpdir()}/${message.id}`);
|
||||||
// Set some defaults
|
// Set some defaults
|
||||||
const TOP_TEXT = options[0];
|
const TOP_TEXT = options[0];
|
||||||
const BOTTOM_TEXT = options[1];
|
const BOTTOM_TEXT = options[1];
|
||||||
|
|
Loading…
Reference in a new issue