mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-22 18:29:14 +02:00
Fix
This commit is contained in:
@@ -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);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user