diff --git a/README.md b/README.md index 5f233897..f22a6563 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,7 @@ Only if you want to use the DECTalk command. 18. Start Xiao up! ## Commands -Total: 514 +Total: 515 ### Utility: @@ -548,6 +548,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. +* **holy-crap-lois:** Draws an image or a user\'s avatar at the door to Peter Griffin's house. * **i-cant-believe:** Sends a "I Can't believe it's not butter!" meme with the text 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. @@ -1311,6 +1312,8 @@ Total: 514 * **gru-plan:** - [Illumination](http://www.illumination.com/) ([Original "Despicable Me" Movie](http://www.despicable.me/)) - [Google](https://www.google.com/) ([Noto Font](https://fonts.google.com/noto)) +* **holy-crap-lois:** + - [20th Century Fox](https://www.foxmovies.com/) (Image, Original "Family Guy" Show) * **i-cant-believe:** - [I Can't Believe It's Not Butter!](https://www.icantbelieveitsnotbutter.com/en) (Original Logo) - [Kong Font](https://www.dafont.com/kong-font.d8299) ([The Lord Night Font](https://www.dafont.com/the-lord-night.font)) diff --git a/assets/images/holy-crap-lois/bg.png b/assets/images/holy-crap-lois/bg.png new file mode 100644 index 00000000..a0ee53ce Binary files /dev/null and b/assets/images/holy-crap-lois/bg.png differ diff --git a/assets/images/holy-crap-lois/door.png b/assets/images/holy-crap-lois/door.png new file mode 100644 index 00000000..ee36487e Binary files /dev/null and b/assets/images/holy-crap-lois/door.png differ diff --git a/commands/edit-meme/holy-crap-lois.js b/commands/edit-meme/holy-crap-lois.js new file mode 100644 index 00000000..4d64f5db --- /dev/null +++ b/commands/edit-meme/holy-crap-lois.js @@ -0,0 +1,51 @@ +const Command = require('../../framework/Command'); +const { PermissionFlagsBits } = require('discord.js'); +const { createCanvas, loadImage } = require('@napi-rs/canvas'); +const request = require('node-superfetch'); +const path = require('path'); +const { centerImagePart } = require('../../util/Canvas'); + +module.exports = class HolyCrapLoisCommand extends Command { + constructor(client) { + super(client, { + name: 'holy-crap-lois', + aliases: ['holy-crap', 'peter-door', 'peter-at-the-door'], + group: 'edit-meme', + description: 'Draws an image or a user\'s avatar at the door to Peter Griffin\'s house.', + throttling: { + usages: 2, + duration: 10 + }, + clientPermissions: [PermissionFlagsBits.AttachFiles], + credit: [ + { + name: '20th Century Fox', + url: 'https://www.foxmovies.com/', + reason: 'Image, Original "Family Guy" Show' + }, + ], + args: [ + { + key: 'image', + type: 'image-or-avatar', + avatarSize: 512, + default: msg => msg.author.displayAvatarURL({ extension: 'png', size: 512, forceStatic: true }) + } + ] + }); + } + + async run(msg, { image }) { + const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'holy-crap-lois', `bg.png`)); + const door = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'holy-crap-lois', `door.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, 424, 424, 0, 40); + ctx.drawImage(data, x, y, width, height); + ctx.drawImage(door, 0, 0); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'holy-crap-lois.png' }] }); + } +}; diff --git a/package.json b/package.json index bce2b4c1..9931f829 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "159.1.1", + "version": "159.2.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {