diff --git a/commands/avatar-edit/hat.js b/commands/avatar-edit/hat.js index 5f52bcb9..16367773 100644 --- a/commands/avatar-edit/hat.js +++ b/commands/avatar-edit/hat.js @@ -104,12 +104,24 @@ module.exports = class HatCommand extends Command { prompt: 'Which user would you like to edit the avatar of?', type: 'user', default: msg => msg.author + }, + { + key: 'addX', + prompt: 'How far do you want to move the hat on the X-Axis?', + type: 'integer', + default: 0 + }, + { + key: 'addY', + prompt: 'How far do you want to move the hat on the Y-Axis?', + type: 'integer', + default: 0 } ] }); } - async run(msg, { type, user }) { + async run(msg, { type, user, addX, addY }) { const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 }); try { const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'hat', `${type}.png`)); @@ -118,7 +130,7 @@ module.exports = class HatCommand extends Command { const canvas = createCanvas(avatar.width, avatar.height); const ctx = canvas.getContext('2d'); ctx.drawImage(avatar, 0, 0); - ctx.drawImage(base, 0, 0, avatar.width, avatar.height); + ctx.drawImage(base, 0 + addX, 0 + addY, avatar.width, avatar.height); return msg.say({ files: [{ attachment: canvas.toBuffer(), name: `${type}-hat.png` }] }); } catch (err) { return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); diff --git a/package.json b/package.json index 33e3e451..8ba0527e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "112.19.5", + "version": "112.19.6", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {