napi-rs/canvas doesn't support line breaks????

This commit is contained in:
Dragon Fire
2024-05-03 01:49:01 -04:00
parent 570149028a
commit 8a5af83844
173 changed files with 332 additions and 332 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
const Command = require('../../framework/Command');
const { PermissionFlagsBits } = require('discord.js');
const { createCanvas, loadImage } = require('@napi-rs/canvas');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const { wrapText } = require('../../util/Canvas');
@@ -63,7 +63,7 @@ module.exports = class SubtitleCommand extends Command {
ctx.fillStyle = 'yellow';
ctx.fillText(lines[i], base.width / 2, textHeight);
}
const attachment = canvas.toBuffer('image/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: 'subtitle.png' }] });
}