Transfer to @napi-rs/canvas again (this time w/ line breaks)

This commit is contained in:
Dragon Fire
2024-05-03 10:21:28 -04:00
parent 0d04b94797
commit bed3847f60
174 changed files with 234 additions and 227 deletions
+3 -3
View File
@@ -1,8 +1,8 @@
const Command = require('../../framework/Command');
const { PermissionFlagsBits } = require('discord.js');
const { createCanvas, loadImage } = require('canvas');
const { createCanvas, loadImage } = require('@napi-rs/canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
const { wrapText, fillTextWithBreaks } = require('../../util/Canvas');
module.exports = class ZeroDialogueCommand extends Command {
constructor(client) {
@@ -63,7 +63,7 @@ module.exports = class ZeroDialogueCommand extends Command {
ctx.textBaseline = 'top';
let text = wrapText(ctx, quote, 425);
text = text.length > 2 ? `${text.slice(0, 2).join('\n')}...` : text.join('\n');
ctx.fillText(text, 8, 8);
fillTextWithBreaks(ctx, text, 8, 8);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'zero-dialogue.png' }] });
}
};