mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-15 15:57:47 +02:00
Transition to @napi-rs/canvas
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const { PermissionFlagsBits } = require('discord.js');
|
||||
const { createCanvas, loadImage } = require('canvas');
|
||||
const { createCanvas, loadImage } = require('@napi-rs/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();
|
||||
const attachment = canvas.toBuffer('image/png');
|
||||
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||
return msg.say({ files: [{ attachment, name: 'subtitle.png' }] });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user