mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-14 08:08:34 +02:00
Wrap text in be like bill
This commit is contained in:
@@ -2,6 +2,7 @@ const Command = require('../../structures/Command');
|
||||
const { createCanvas, loadImage, registerFont } = require('canvas');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const path = require('path');
|
||||
const { wrapText } = require('../../util/Canvas');
|
||||
const texts = require('../../assets/json/be-like-bill');
|
||||
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
|
||||
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
|
||||
@@ -25,7 +26,8 @@ module.exports = class BeLikeBillCommand extends Command {
|
||||
key: 'name',
|
||||
prompt: 'What should the name on the meme be?',
|
||||
type: 'string',
|
||||
default: 'Bill'
|
||||
default: 'Bill',
|
||||
max: 20
|
||||
}
|
||||
]
|
||||
});
|
||||
@@ -37,10 +39,11 @@ module.exports = class BeLikeBillCommand extends Command {
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(base, 0, 0);
|
||||
ctx.font = '23px Noto';
|
||||
const text = wrapText(ctx, texts[Math.floor(Math.random() * texts.length)].replace(/{{name}}/gi, name), 600 - 31);
|
||||
ctx.fillText(stripIndents`
|
||||
This is ${name}.
|
||||
|
||||
${texts[Math.floor(Math.random() * texts.length)].replace(/{{name}}/gi, name)}
|
||||
${text.join('\n')}
|
||||
|
||||
${name} is smart.
|
||||
Be like ${name}.
|
||||
|
||||
@@ -25,15 +25,13 @@ module.exports = class NikeAdCommand extends Command {
|
||||
key: 'something',
|
||||
prompt: 'What should the something to believe in be?',
|
||||
type: 'string',
|
||||
max: 50,
|
||||
parse: something => something.toLowerCase()
|
||||
max: 50
|
||||
},
|
||||
{
|
||||
key: 'sacrifice',
|
||||
prompt: 'What should believing result in (e.g. sacrificing everything)?',
|
||||
type: 'string',
|
||||
max: 50,
|
||||
parse: sacrifice => sacrifice.toLowerCase()
|
||||
max: 50
|
||||
},
|
||||
{
|
||||
key: 'image',
|
||||
|
||||
Reference in New Issue
Block a user