Face Analyze, Analyze group

This commit is contained in:
Daniel Odendahl Jr
2018-03-08 22:49:19 +00:00
parent 35f4bd0bbe
commit 10e9fc0c02
18 changed files with 88 additions and 21 deletions
+3 -1
View File
@@ -34,7 +34,9 @@ module.exports = class InvertCommand extends Command {
const ctx = canvas.getContext('2d');
ctx.drawImage(data, 0, 0);
invert(ctx, 0, 0, data.width, data.height);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'invert.png' }] });
const attachment = canvas.toBuffer();
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
return msg.say({ files: [{ attachment, name: 'invert.png' }] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}