From 60eebbe5067b2562335d94e636f188a70e833244 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Bersier?= Date: Wed, 13 Feb 2019 01:53:50 +0100 Subject: [PATCH] Paint image command --- commands/images/{paint.WIP => paint.js} | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) rename commands/images/{paint.WIP => paint.js} (80%) diff --git a/commands/images/paint.WIP b/commands/images/paint.js similarity index 80% rename from commands/images/paint.WIP rename to commands/images/paint.js index 19dfe0c..a2cf017 100644 --- a/commands/images/paint.WIP +++ b/commands/images/paint.js @@ -32,14 +32,13 @@ class paintCommand extends Command { const canvas = createCanvas(528, 559); const ctx = canvas.getContext('2d'); - const background = await loadImage('https://cdn.discordapp.com/attachments/488483518742134794/542633779601342476/260293545019212.png').catch(() => { + const background = await loadImage(image).catch(() => { return message.channel.send('An error as occured, please try again'); }); - ctx.drawImage(background, 0, 0, canvas.width, canvas.height); - const { body: buffer } = await superagent.get(image); + ctx.drawImage(background, 50, 50, 480, 450); + const { body: buffer } = await superagent.get('https://cdn.discordapp.com/attachments/488483518742134794/542633779601342476/260293545019212.png'); const bg = await loadImage(buffer); - ctx.drawImage(bg, 50, 50, 450, 450); - + ctx.drawImage(bg, 0, 0, canvas.width, canvas.height); message.channel.send({files: [canvas.toBuffer()]}).catch(() => { message.channel.send('an error as occured. Check the bot/channel permissions');