More Stoof

This commit is contained in:
Daniel Odendahl Jr
2017-10-13 17:33:29 +00:00
parent 76111000b5
commit 981f59b1b1
40 changed files with 228 additions and 125 deletions
+6 -3
View File
@@ -33,16 +33,19 @@ module.exports = class PhotographCommand extends Command {
size: 256
});
try {
const canvas = createCanvas(625, 417);
const ctx = canvas.getContext('2d');
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'photograph.png'));
const { body } = await snekfetch.get(avatarURL);
const avatar = await loadImage(body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.rotate(-8.21 * (Math.PI / 180));
ctx.drawImage(avatar, 85, 116, 150, 150);
ctx.rotate(8.21 * (Math.PI / 180));
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'photograph.png' }] });
return msg.say({ files: [{
attachment: canvas.toBuffer(),
name: 'photograph.png'
}] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}