mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-21 14:04:38 +02:00
Transition to @napi-rs/canvas
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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' }] });
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user