mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-27 22:27:44 +02:00
Bart Chalkboard mobile bart
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 62 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 151 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
@@ -41,7 +41,10 @@ module.exports = class LisaPresentationCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, { text }) {
|
async run(msg, { text }) {
|
||||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'bart-chalkboard.png'));
|
const base = await loadImage(
|
||||||
|
path.join(__dirname, '..', '..', 'assets', 'images', 'bart-chalkboard', 'chalkboard.png')
|
||||||
|
);
|
||||||
|
const bart = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'bart-chalkboard', 'bart.png'));
|
||||||
const canvas = createCanvas(base.width, base.height);
|
const canvas = createCanvas(base.width, base.height);
|
||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
ctx.drawImage(base, 0, 0);
|
ctx.drawImage(base, 0, 0);
|
||||||
@@ -49,9 +52,11 @@ module.exports = class LisaPresentationCommand extends Command {
|
|||||||
ctx.font = this.client.fonts.get('akbar.ttf').toCanvasString(19);
|
ctx.font = this.client.fonts.get('akbar.ttf').toCanvasString(19);
|
||||||
ctx.fillStyle = 'white';
|
ctx.fillStyle = 'white';
|
||||||
const shortened = shortenText(ctx, text.toUpperCase(), 500);
|
const shortened = shortenText(ctx, text.toUpperCase(), 500);
|
||||||
|
const len = ctx.measureText(shortened);
|
||||||
const arr = [];
|
const arr = [];
|
||||||
for (let i = 0; i < 12; i++) arr.push(shortened);
|
for (let i = 0; i < 12; i++) arr.push(shortened);
|
||||||
fillTextWithBreaks(ctx, arr.join('\n'), 30, 27);
|
fillTextWithBreaks(ctx, arr.join('\n'), 30, 27);
|
||||||
|
ctx.drawImage(bart, Math.min(522, 30 + len), 142, 103, 212);
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'bart-chalkboard.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'bart-chalkboard.png' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "155.2.2",
|
"version": "155.2.3",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user