diff --git a/README.md b/README.md index 20a08469..e182ceed 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ You can invite the bot to your server using Be sure to also join the [home server](https://discord.gg/sbMe32W) for information and support. -## Commands (288) +## Commands (289) ### Utility: * **prefix**: Shows or sets the command prefix. @@ -234,6 +234,7 @@ information and support. * **illegal**: Makes President Trump make your text illegal. * **invert**: Draws an image or a user's avatar but inverted. * **meme**: Sends a meme with the text and background of your choice. +* **minecraft-skin**: Sends the Minecraft skin for a user. * **osu-signature**: Creates a card based on an osu! user's stats. * **pokemon-fusion**: Fuses two Generation I Pokémon together. * **robohash**: Creates a robot based on the text you provide. diff --git a/commands/image-edit/minecraft-skin.js b/commands/image-edit/minecraft-skin.js new file mode 100644 index 00000000..dd414cfd --- /dev/null +++ b/commands/image-edit/minecraft-skin.js @@ -0,0 +1,46 @@ +const Command = require('../../structures/Command'); +const request = require('node-superfetch'); +const { list } = require('../../util/Util'); +const types = ['face', 'front', 'frontfull', 'head', 'bust', 'full', 'skin']; + +module.exports = class MinecraftSkinCommand extends Command { + constructor(client) { + super(client, { + name: 'minecraft-skin', + group: 'image-edit', + memberName: 'minecraft-skin', + description: 'Sends the Minecraft skin for a user.', + details: `**Types**: ${types.join(', ')}`, + clientPermissions: ['ATTACH_FILES'], + args: [ + { + key: 'user', + prompt: 'What user would you like to get the skin of?', + type: 'string', + parse: user => encodeURIComponent(user) + }, + { + key: 'type', + prompt: `What type should the skin be rendered in? Either ${list(types, 'or')}.`, + type: 'string', + default: 'full', + validate: type => { + if (types.includes(type.toLowerCase())) return true; + return `Invalid type, please enter either ${list(types, 'or')}.`; + }, + parse: type => type.toLowerCase() + } + ] + }); + } + + async run(msg, { user, type }) { + try { + const search = await request.get(`https://api.mojang.com/users/profiles/minecraft/${user}`); + if (search.status === 204) return msg.say('Could not find any results.'); + return msg.say({ files: [`https://visage.surgeplay.com/${type}/512/${search.body.id}.png`] }); + } catch (err) { + return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); + } + } +}; diff --git a/commands/image-edit/osu-signature.js b/commands/image-edit/osu-signature.js index f46cfb6f..e084e959 100644 --- a/commands/image-edit/osu-signature.js +++ b/commands/image-edit/osu-signature.js @@ -11,6 +11,7 @@ module.exports = class OsuSignatureCommand extends Command { group: 'image-edit', memberName: 'osu-signature', description: 'Creates a card based on an osu! user\'s stats.', + details: `**Colors**: ${Object.keys(colors).join(', ')}`, clientPermissions: ['ATTACH_FILES'], args: [ { diff --git a/package.json b/package.json index 2855d558..a0a2b7b1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "83.0.0", + "version": "83.1.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {