diff --git a/assets/images/simba.png b/assets/images/he-lives-in-you.png similarity index 100% rename from assets/images/simba.png rename to assets/images/he-lives-in-you.png diff --git a/assets/images/i-have-the-power.png b/assets/images/i-have-the-power.png new file mode 100644 index 00000000..130de274 Binary files /dev/null and b/assets/images/i-have-the-power.png differ diff --git a/commands/avatar-edit/simba.js b/commands/avatar-edit/he-lives-in-you.js similarity index 84% rename from commands/avatar-edit/simba.js rename to commands/avatar-edit/he-lives-in-you.js index 32f384fa..38c2e8f7 100644 --- a/commands/avatar-edit/simba.js +++ b/commands/avatar-edit/he-lives-in-you.js @@ -3,13 +3,13 @@ const { createCanvas, loadImage } = require('canvas'); const snekfetch = require('snekfetch'); const path = require('path'); -module.exports = class SimbaCommand extends Command { +module.exports = class HeLivesInYouCommand extends Command { constructor(client) { super(client, { - name: 'simba', - aliases: ['mufasa', 'he-lives-in-you'], + name: 'he-lives-in-you', + aliases: ['mufasa', 'simba'], group: 'avatar-edit', - memberName: 'simba', + memberName: 'he-lives-in-you', description: 'Draws a user\'s avatar over Simba from The Lion King\'s reflection.', throttling: { usages: 1, @@ -36,14 +36,14 @@ module.exports = class SimbaCommand extends Command { try { const canvas = createCanvas(500, 281); const ctx = canvas.getContext('2d'); - const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'simba.png')); + const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'he-lives-in-you.png')); const { body } = await snekfetch.get(avatarURL); const avatar = await loadImage(body); ctx.drawImage(base, 0, 0); ctx.rotate(-24 * (Math.PI / 180)); ctx.drawImage(avatar, 75, 160, 130, 150); ctx.rotate(24 * (Math.PI / 180)); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'simba.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'he-lives-in-you.png' }] }); } catch (err) { return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); } diff --git a/commands/avatar-edit/i-have-the-power.js b/commands/avatar-edit/i-have-the-power.js new file mode 100644 index 00000000..8b6f2140 --- /dev/null +++ b/commands/avatar-edit/i-have-the-power.js @@ -0,0 +1,51 @@ +const Command = require('../../structures/Command'); +const { createCanvas, loadImage } = require('canvas'); +const snekfetch = require('snekfetch'); +const path = require('path'); + +module.exports = class IHaveThePowerCommand extends Command { + constructor(client) { + super(client, { + name: 'i-have-the-power', + aliases: ['he-man'], + group: 'avatar-edit', + memberName: 'i-have-the-power', + description: 'Draws a user\'s avatar over He-Man\'s face.', + throttling: { + usages: 1, + duration: 15 + }, + clientPermissions: ['ATTACH_FILES'], + args: [ + { + key: 'user', + prompt: 'Which user would you like to edit the avatar of?', + type: 'user', + default: '' + } + ] + }); + } + + async run(msg, { user }) { + if (!user) user = msg.author; + const avatarURL = user.displayAvatarURL({ + format: 'png', + size: 512 + }); + try { + const canvas = createCanvas(720, 536); + const ctx = canvas.getContext('2d'); + const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'i-have-the-power.png')); + const { body } = await snekfetch.get(avatarURL); + const avatar = await loadImage(body); + ctx.drawImage(base, 0, 0); + ctx.rotate(18.3 * (Math.PI / 180)); + ctx.drawImage(avatar, 322, 6, 371, 371); + ctx.rotate(-18.3 * (Math.PI / 180)); + return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'i-have-the-power.png' }] }); + } catch (err) { + return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); + } + } +}; diff --git a/package.json b/package.json index ce7e038a..80c7616c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiaobot", - "version": "42.14.2", + "version": "42.15.0", "description": "Your personal server companion.", "main": "Shard.js", "scripts": {