mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-25 06:42:51 +02:00
Increase file size limit to 25MB
This commit is contained in:
@@ -35,7 +35,7 @@ module.exports = class DeepFryCommand extends Command {
|
||||
desaturate(ctx, -20, 0, 0, data.width, data.height);
|
||||
contrast(ctx, 0, 0, data.width, data.height);
|
||||
const attachment = canvas.toBuffer('image/jpeg', { quality: 0.2 });
|
||||
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||
if (Buffer.byteLength(attachment) > 2.5e+7) return msg.reply('Resulting image was above 25 MB.');
|
||||
return msg.say({ files: [{ attachment, name: 'deep-fry.jpeg' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -46,7 +46,7 @@ module.exports = class DislikeCommand extends Command {
|
||||
ctx.drawImage(base, 0, 0, plate.width, height);
|
||||
ctx.drawImage(plate, 0, height);
|
||||
const attachment = canvas.toBuffer('image/png');
|
||||
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||
if (Buffer.byteLength(attachment) > 2.5e+7) return msg.reply('Resulting image was above 25 MB.');
|
||||
return msg.say({ files: [{ attachment, name: 'dislike.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -46,7 +46,7 @@ module.exports = class ForFiveHoursCommand extends Command {
|
||||
ctx.drawImage(base, 0, 0, plate.width, height);
|
||||
ctx.drawImage(plate, 0, height + 1);
|
||||
const attachment = canvas.toBuffer('image/png');
|
||||
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||
if (Buffer.byteLength(attachment) > 2.5e+7) return msg.reply('Resulting image was above 25 MB.');
|
||||
return msg.say({ files: [{ attachment, name: 'for-five-hours.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -46,7 +46,7 @@ module.exports = class LikeCommand extends Command {
|
||||
ctx.drawImage(base, 0, 0, plate.width, height);
|
||||
ctx.drawImage(plate, 0, height);
|
||||
const attachment = canvas.toBuffer('image/png');
|
||||
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||
if (Buffer.byteLength(attachment) > 2.5e+7) return msg.reply('Resulting image was above 25 MB.');
|
||||
return msg.say({ files: [{ attachment, name: 'like.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -81,7 +81,7 @@ module.exports = class MemeGenCommand extends Command {
|
||||
ctx.fillText(bottomLines[i], base.width / 2, textHeight);
|
||||
}
|
||||
const attachment = canvas.toBuffer('image/png');
|
||||
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||
if (Buffer.byteLength(attachment) > 2.5e+7) return msg.reply('Resulting image was above 25 MB.');
|
||||
return msg.say({ files: [{ attachment, name: 'meme-gen.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -75,7 +75,7 @@ module.exports = class NikeAdCommand extends Command {
|
||||
ctx.fillText(lines[i], data.width / 2, textHeight);
|
||||
}
|
||||
const attachment = canvas.toBuffer('image/png');
|
||||
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||
if (Buffer.byteLength(attachment) > 2.5e+7) return msg.reply('Resulting image was above 25 MB.');
|
||||
return msg.say({ files: [{ attachment, name: 'nike-ad.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -61,7 +61,7 @@ module.exports = class ReactionMemeCommand extends Command {
|
||||
fillTextWithBreaks(ctx, lines.join('\n'), 5, 5);
|
||||
ctx.drawImage(base, 0, linesLen);
|
||||
const attachment = canvas.toBuffer('image/png');
|
||||
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||
if (Buffer.byteLength(attachment) > 2.5e+7) return msg.reply('Resulting image was above 25 MB.');
|
||||
return msg.say({ files: [{ attachment, name: 'meme-gen-modern.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -43,7 +43,7 @@ module.exports = class SexySinglesCommand extends Command {
|
||||
ctx.drawImage(base, plate.width, 0, width, plate.height);
|
||||
ctx.drawImage(plate, 0, 0);
|
||||
const attachment = canvas.toBuffer('image/png');
|
||||
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||
if (Buffer.byteLength(attachment) > 2.5e+7) return msg.reply('Resulting image was above 25 MB.');
|
||||
return msg.say({ files: [{ attachment, name: 'sexy-singles.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -65,7 +65,7 @@ module.exports = class SkyrimSkillCommand extends Command {
|
||||
ctx.fillStyle = 'white';
|
||||
ctx.fillText(skill, 189, height + 75, 300);
|
||||
const attachment = canvas.toBuffer('image/png');
|
||||
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||
if (Buffer.byteLength(attachment) > 2.5e+7) return msg.reply('Resulting image was above 25 MB.');
|
||||
return msg.say({ files: [{ attachment, name: 'skyrim-skill.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -49,7 +49,7 @@ module.exports = class ThugLifeCommand extends Command {
|
||||
const height = Math.round(width / ratio);
|
||||
ctx.drawImage(base, (data.width / 2) - (width / 2), data.height - height, width, height);
|
||||
const attachment = canvas.toBuffer('image/png');
|
||||
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||
if (Buffer.byteLength(attachment) > 2.5e+7) return msg.reply('Resulting image was above 25 MB.');
|
||||
return msg.say({ files: [{ attachment, name: 'thug-life.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -47,7 +47,7 @@ module.exports = class ToBeContinuedCommand extends Command {
|
||||
const height = Math.round(width / ratio);
|
||||
ctx.drawImage(base, 0, canvas.height - height, width, height);
|
||||
const attachment = canvas.toBuffer('image/png');
|
||||
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||
if (Buffer.byteLength(attachment) > 2.5e+7) return msg.reply('Resulting image was above 25 MB.');
|
||||
return msg.say({ files: [{ attachment, name: 'to-be-continued.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -46,7 +46,7 @@ module.exports = class VietnamFlashbacksCommand extends Command {
|
||||
ctx.globalAlpha = 0.675;
|
||||
ctx.drawImage(data, 0, 0);
|
||||
const attachment = canvas.toBuffer('image/png');
|
||||
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||
if (Buffer.byteLength(attachment) > 2.5e+7) return msg.reply('Resulting image was above 25 MB.');
|
||||
return msg.say({ files: [{ attachment, name: 'vietnam-flashbacks.png' }] });
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user