This commit is contained in:
Daniel Odendahl Jr
2017-10-09 12:39:35 +00:00
parent c1ea014fec
commit bf19c9e398
3 changed files with 15 additions and 19 deletions
+13 -17
View File
@@ -32,25 +32,21 @@ module.exports = class BeLikeBillCommand extends Command {
}
async run(msg, { name }) {
try {
const canvas = createCanvas(800, 420);
const ctx = canvas.getContext('2d');
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'be-like-bill.png'));
ctx.drawImage(base, 0, 0);
ctx.font = '23px Noto';
const text = stripIndents`
This is ${name}.
const canvas = createCanvas(800, 420);
const ctx = canvas.getContext('2d');
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'be-like-bill.png'));
ctx.drawImage(base, 0, 0);
ctx.font = '23px Noto';
const text = stripIndents`
This is ${name}.
${texts[Math.floor(Math.random() * texts.length)].replace(/{{name}}/gi, name)}
${texts[Math.floor(Math.random() * texts.length)].replace(/{{name}}/gi, name)}
${name} is smart.
Be like ${name}.
`;
ctx.fillText(text, 31, 80);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'be-like-bill.png' }] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
${name} is smart.
Be like ${name}.
`;
ctx.fillText(text, 31, 80);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'be-like-bill.png' }] });
}
};