From 512033b1c53932c51532e1649ca04c3e345da14e Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Wed, 10 May 2017 22:36:55 +0000 Subject: [PATCH] waergsklngser --- commands/avataredit/card.js | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/commands/avataredit/card.js b/commands/avataredit/card.js index 39cdb650..ce7bfbff 100644 --- a/commands/avataredit/card.js +++ b/commands/avataredit/card.js @@ -31,11 +31,6 @@ module.exports = class CardCommand extends Command { if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) return msg.say('This Command requires the `Attach Files` Permission.'); const { member } = args; - const username = member.displayName; - const discordJoin = moment(member.user.createdTimestamp).format('MMMM Do YYYY'); - const serverJoin = moment(member.joinedTimestamp).format('MMMM Do YYYY'); - const owner = this.client.isOwner(member.user); - const discrim = `#${member.user.discriminator}`; const cardID = Math.floor(Math.random() * (9999 - 1000 + 1)) + 1000; let rarity; if (cardID < 5000) rarity = 'C'; @@ -50,40 +45,35 @@ module.exports = class CardCommand extends Command { const ctx = canvas.getContext('2d'); const base = new Image(); const avatar = new Image(); - const crown = new Image(); const generate = () => { ctx.fillStyle = 'white'; ctx.fillRect(0, 0, 390, 544); ctx.drawImage(avatar, 11, 11, 370, 370); ctx.drawImage(base, 0, 0); - if (owner) ctx.drawImage(crown, 60, 480, 40, 30); ctx.font = '18px Open Sans'; ctx.fillStyle = 'black'; - ctx.fillText(username, 30, 65); + ctx.fillText(member.displayName, 30, 65); ctx.fillText('Discord Join Date:', 148, 400); - ctx.fillText(discordJoin, 148, 420); + ctx.fillText(moment(member.user.createdTimestamp).format('MMMM Do YYYY'), 148, 420); ctx.fillText('Server Join Date:', 148, 457); - ctx.fillText(serverJoin, 148, 477); + ctx.fillText(moment(member.joinedTimestamp).format('MMMM Do YYYY'), 148, 477); ctx.fillText(rarity, 73, 416); ctx.fillText(cardID, 58, 460); ctx.font = '14px Open Sans'; ctx.fillText(member.id, 28, 355); - ctx.fillText(discrim, 306, 359); + ctx.fillText(`#${member.user.discriminator}`, 306, 359); }; const cardImg = await request .get('https://i.imgur.com/6j8RHk1.png'); const avatarImg = await request .get(avatarURL); - const crownImg = await request - .get('https://i.imgur.com/HK4Fnus.png'); base.src = cardImg.body; avatar.src = avatarImg.body; - crownImg.src = crownImg.body; generate(); return msg.channel.send({ files: [{ attachment: canvas.toBuffer(), name: 'card.png' }] }) .catch(err => msg.say(err)); } catch (err) { - return msg.say('An Error Occurred while creating the image. ' + err); + return msg.say('An Error Occurred while creating the image. ' + err.stack); } } };