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
+1 -1
View File
@@ -53,7 +53,7 @@ module.exports = class MathGameCommand extends Command {
time: 10000 time: 10000
}); });
if (!msgs.size) return msg.say(`Time! It was ${answer}, sorry!`); if (!msgs.size) return msg.say(`Time! It was ${answer}, sorry!`);
if (msgs.first().content !== answer) return msg.say(`Nope, sorry, it's ${answer}.`); if (msgs.first().content !== answer.toString()) return msg.say(`Nope, sorry, it's ${answer}.`);
return msg.say('Nice job! 10/10! You deserve some cake!'); return msg.say('Nice job! 10/10! You deserve some cake!');
} }
}; };
+13 -17
View File
@@ -32,25 +32,21 @@ module.exports = class BeLikeBillCommand extends Command {
} }
async run(msg, { name }) { async run(msg, { name }) {
try { const canvas = createCanvas(800, 420);
const canvas = createCanvas(800, 420); const ctx = canvas.getContext('2d');
const ctx = canvas.getContext('2d'); const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'be-like-bill.png'));
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'be-like-bill.png')); ctx.drawImage(base, 0, 0);
ctx.drawImage(base, 0, 0); ctx.font = '23px Noto';
ctx.font = '23px Noto'; const text = stripIndents`
const text = stripIndents` This is ${name}.
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. ${name} is smart.
Be like ${name}. Be like ${name}.
`; `;
ctx.fillText(text, 31, 80); ctx.fillText(text, 31, 80);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'be-like-bill.png' }] }); 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!`);
}
} }
}; };
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "xiaobot", "name": "xiaobot",
"version": "46.1.0", "version": "46.1.1",
"description": "Your personal server companion.", "description": "Your personal server companion.",
"main": "Shard.js", "main": "Shard.js",
"scripts": { "scripts": {