diff --git a/README.md b/README.md index c52af74d..48245d8d 100644 --- a/README.md +++ b/README.md @@ -231,7 +231,7 @@ in the appropriate channel's topic to use it. ## Commands -Total: 514 +Total: 515 ### Utility: @@ -670,6 +670,7 @@ Total: 514 * **genie-rules:** Sends a "There are 4 rules" meme with the text of your choice. * **girl-worth-fighting-for:** Draws an image or a user's avatar as the object of Ling's affection. * **gru-plan:** Sends a Gru's Plan meme with steps of your choice. +* **i-fear-no-man:** Sends a "I fear no man" meme with the text of your choice. * **if-those-kids-could-read:** Sends a "If those kids could read, they'd be very upset" meme with the text of your choice. * **illegal:** Makes President Trump make your text illegal. * **kyon-gun:** Draws an image or a user's avatar behind Kyon shooting a gun. @@ -1352,6 +1353,7 @@ here. * gun (Concept) * hands (Concept) * hentai (Original Subreddit List) + * i-fear-no-man (Concept) * if-those-kids-could-read (Concept) * like (Concept) * pills (Concept) @@ -1599,6 +1601,7 @@ here. * usps-tracking ([API](https://www.usps.com/business/web-tools-apis/)) - [Valve](https://www.valvesoftware.com/en/) * fact-core ([Original "Portal 2" Game](http://www.thinkwithportals.com/)) + * i-fear-no-man ([Image, Original "Team Fortress 2" Game](https://www.teamfortress.com/)) * oracle-turret ([Original "Portal 2" Game](http://www.thinkwithportals.com/)) - [vician](https://www.123rf.com/profile_vician) * rip ([Image](https://www.123rf.com/profile_vician?mediapopup=13181623)) diff --git a/assets/images/i-fear-no-man.png b/assets/images/i-fear-no-man.png new file mode 100644 index 00000000..88eee46b Binary files /dev/null and b/assets/images/i-fear-no-man.png differ diff --git a/commands/edit-meme/i-fear-no-man.js b/commands/edit-meme/i-fear-no-man.js new file mode 100644 index 00000000..14254927 --- /dev/null +++ b/commands/edit-meme/i-fear-no-man.js @@ -0,0 +1,59 @@ +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 IFearNoManCommand extends Command { + constructor(client) { + super(client, { + name: 'i-fear-no-man', + aliases: ['i-fear-no', 'i-fear', 'it-scares-me'], + group: 'edit-meme', + memberName: 'i-fear-no-man', + description: 'Sends a "I fear no man" meme with the text of your choice.', + throttling: { + usages: 1, + duration: 10 + }, + clientPermissions: ['ATTACH_FILES'], + credit: [ + { + name: 'Valve', + url: 'https://www.valvesoftware.com/en/', + reasonURL: 'https://www.teamfortress.com/', + reason: 'Image, Original "Team Fortress 2" Game' + }, + { + name: 'Overtime2005', + url: 'https://github.com/Overtime2005', + reason: 'Concept' + } + ], + 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', 'i-fear-no-man.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, 169, 169, 167, 330); + ctx.drawImage(data, x, y, width, height); + return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'i-fear-no-man.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 e2bef80d..81ca4a33 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "117.10.0", + "version": "117.11.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {