diff --git a/README.md b/README.md index 3d5f43e5..7dfafd4b 100644 --- a/README.md +++ b/README.md @@ -227,7 +227,7 @@ in the appropriate channel's topic to use it. ## Commands -Total: 487 +Total: 488 ### Utility: @@ -666,6 +666,7 @@ Total: 487 * **sora-selfie:** Draws an image or a user's avatar behind Sora taking a selfie. * **sos:** Sends a "Esther Verkest's Help Sign" comic with the text of your choice. * **spongebob-burn:** Sends a "Spongebob Throwing Something into a Fire" meme with words of your choice. +* **this-guy:** Draws an image or a user's avatar over the "Get a load of this guy" meme. * **thug-life:** Draws "Thug Life" over an image or a user's avatar. * **to-be-continued:** Draws an image with the "To Be Continued..." arrow. * **two-buttons:** Sends a "Two Buttons" meme with the buttons of your choice. @@ -1521,6 +1522,7 @@ here. * what-anime ([API](https://soruly.github.io/trace.moe/#/)) - [Warner Bros.](https://www.warnerbros.com/) * phoebe-teaching-joey ([Images, Original "Friends" TV Series](https://www.warnerbros.com/tv/friends/)) + * this-guy ([Image, Original "Friends" TV Series](https://www.warnerbros.com/tv/friends/)) - [Wattpad](https://www.wattpad.com/) * wattpad ([API](https://www.wattpad.com/developer/docs/api)) - [Why We Protest](https://whyweprotest.net/) diff --git a/assets/images/this-guy.png b/assets/images/this-guy.png new file mode 100644 index 00000000..463faaf7 Binary files /dev/null and b/assets/images/this-guy.png differ diff --git a/commands/edit-meme/this-guy.js b/commands/edit-meme/this-guy.js new file mode 100644 index 00000000..6ec9951c --- /dev/null +++ b/commands/edit-meme/this-guy.js @@ -0,0 +1,54 @@ +const Command = require('../../structures/Command'); +const { createCanvas, loadImage } = require('canvas'); +const request = require('node-superfetch'); +const path = require('path'); +const { centerImagePart } = require('../../util/Canvas'); + +module.exports = class ThisGuyCommand extends Command { + constructor(client) { + super(client, { + name: 'this-guy', + aliases: ['get-a-load-of-this-guy'], + group: 'edit-meme', + memberName: 'this-guy', + description: 'Draws an image or a user\'s avatar over the \"Get a load of this guy\" meme.', + throttling: { + usages: 1, + duration: 10 + }, + clientPermissions: ['ATTACH_FILES'], + credit: [ + { + name: 'Warner Bros.', + url: 'https://www.warnerbros.com/', + reason: 'Image, Original "Friends" TV Series', + reasonURL: 'https://www.warnerbros.com/tv/friends/' + } + ], + args: [ + { + key: 'image', + prompt: 'What image would you like to edit?', + type: 'image', + default: msg => msg.author.displayAvatarURL({ format: 'png', size: 256 }) + } + ] + }); + } + + async run(msg, { image }) { + try { + const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'this-guy.png')); + const { body } = await request.get(image); + const data = await loadImage(body); + const canvas = createCanvas(base.width, base.height); + const ctx = canvas.getContext('2d'); + ctx.drawImage(base, 0, 0); + const { x, y, width, height } = centerImagePart(data, 722, 722, 152, 123); + ctx.drawImage(data, x, y, width, height); + return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'this-guy.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 f7d20aeb..12be77f6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "116.28.0", + "version": "116.29.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {