This commit is contained in:
Dragon Fire
2020-06-29 13:21:13 -04:00
parent 10f2ac3c22
commit c04c47c0fd
+5 -5
View File
@@ -30,9 +30,9 @@ module.exports = class MagikCommand extends Command {
try { try {
const { body } = await request.get(image); const { body } = await request.get(image);
const magik = gm(body); const magik = gm(body);
gm.out('-liquid-rescale 75%x75%'); magik.out('-liquid-rescale 75%x75%');
gm.implode(0.25); magik.implode(0.25);
const attachment = await this.toBuffer(gm); const attachment = await this.toBuffer(magik);
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
return msg.say({ files: [{ attachment, name: 'magik.png' }] }); return msg.say({ files: [{ attachment, name: 'magik.png' }] });
} catch (err) { } catch (err) {
@@ -40,9 +40,9 @@ module.exports = class MagikCommand extends Command {
} }
} }
toBuffer(gm) { toBuffer(magik) {
return new Promise((res, rej) => { return new Promise((res, rej) => {
gm.toBuffer('PNG', (err, buffer) => { magik.toBuffer('PNG', (err, buffer) => {
if (err) return rej(err); if (err) return rej(err);
return res(buffer); return res(buffer);
}); });