Transition to @napi-rs/canvas

This commit is contained in:
Dragon Fire
2024-05-03 01:13:32 -04:00
parent 0c9253fe75
commit b504764ba2
173 changed files with 333 additions and 333 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
const Command = require('../../framework/Command');
const { PermissionFlagsBits } = require('discord.js');
const { MersenneTwister19937, integer } = require('random-js');
const { createCanvas, loadImage } = require('canvas');
const { createCanvas, loadImage } = require('@napi-rs/canvas');
const request = require('node-superfetch');
const path = require('path');
const { percentColor } = require('../../util/Util');
@@ -90,7 +90,7 @@ module.exports = class FriendshipCommand extends Command {
ctx.fillText(this.calculateLevelText(level, self, owner, authorUser, botUser), 600, 296);
ctx.font = this.client.fonts.get('Pinky Cupid.otf').toCanvasString(90);
ctx.fillText(level > 49 ? '👍' : '👎', 600, 100);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'friendship.png' }] });
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'friendship.png' }] });
}
calculateLevelText(level, self, owner, authorUser, botUser) {
+2 -2
View File
@@ -1,7 +1,7 @@
const Command = require('../../framework/Command');
const { PermissionFlagsBits } = require('discord.js');
const { MersenneTwister19937, integer } = require('random-js');
const { createCanvas, loadImage } = require('canvas');
const { createCanvas, loadImage } = require('@napi-rs/canvas');
const request = require('node-superfetch');
const path = require('path');
const { percentColor } = require('../../util/Util');
@@ -93,7 +93,7 @@ module.exports = class ShipCommand extends Command {
ctx.fillText(this.calculateLevelText(level, self, owner, authorUser, botUser), 600, 296);
ctx.font = this.client.fonts.get('Pinky Cupid.otf').toCanvasString(90);
ctx.fillText(level > 49 ? '❤️' : '💔', 600, 100);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'ship.png' }] });
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'ship.png' }] });
}
calculateLevelText(level, self, owner, authorUser, botUser) {
+2 -2
View File
@@ -1,7 +1,7 @@
const Command = require('../../framework/Command');
const { PermissionFlagsBits } = require('discord.js');
const { MersenneTwister19937, integer } = require('random-js');
const { createCanvas, loadImage } = require('canvas');
const { createCanvas, loadImage } = require('@napi-rs/canvas');
const request = require('node-superfetch');
const path = require('path');
const { LOVER_USER_ID } = process.env;
@@ -88,6 +88,6 @@ module.exports = class ThinkOfCommand extends Command {
ctx.fillText(thought.text, 600, 296);
ctx.font = this.client.fonts.get('Pinky Cupid.otf').toCanvasString(90);
ctx.fillText(thought.emoji, 600, 100);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'think-of.png' }] });
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'think-of.png' }] });
}
};