diff --git a/README.md b/README.md index 0baf00ca..ef364a7c 100644 --- a/README.md +++ b/README.md @@ -224,7 +224,7 @@ in the appropriate channel's topic to use it. ## Commands -Total: 434 +Total: 436 ### Utility: @@ -592,6 +592,7 @@ Total: 434 * **cursed-sponge:** Sends a cursed sponge duplicated however many times you want. * **dear-liberals:** Sends a "Dear Liberals" meme with words of your choice. * **demotivational:** Draws an image or a user's avatar and the text you specify as a demotivational poster. +* **dislike:** Sends an "Everyone Disliked That" meme with the image of your choice. * **distracted-boyfriend:** Draws three user's avatars over the "Distracted Boyfriend" meme. * **drakeposting:** Draws two user's avatars over the "Drakeposting" meme. * **food-broke:** Draws a user's avatar over the "Food Broke" meme. @@ -600,6 +601,7 @@ Total: 434 * **gru-plan:** Sends a Gru's Plan meme with steps 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. +* **like:** Sends an "Everyone Liked That" meme with the image of your choice. * **lisa-presentation:** Sends a "Lisa Presentation" meme with the presentation of your choice. * **look-at-this-photograph:** Draws an image or a user's avatar over Nickelback's photograph. * **meme-gen:** Sends a meme with the text and background of your choice. @@ -807,6 +809,8 @@ here. - [AZLyrics](https://www.azlyrics.com/) * lyrics (Lyrics Data) - [Bethesda](https://bethesda.net/en/dashboard) + * dislike ([Image, Original "Fallout" Game](https://fallout.bethesda.net/en/)) + * like ([Image, Original "Fallout" Game](https://fallout.bethesda.net/en/)) * skyrim-skill ([Image, Original "The Elder Scrolls V: Skyrim" Game](https://elderscrolls.bethesda.net/en/skyrim)) - [Bob Ross](https://www.bobross.com/) * bob-ross (Himself) @@ -1176,6 +1180,8 @@ here. * osu ([API](https://github.com/ppy/osu-api/wiki)) - [Overtime2005](https://github.com/Overtime2005) * alert (Concept) + * dislike (Concept) + * like (Concept) * simp (Concept) - [PAC-MAN Party](http://pacman.com/en/pac-man-games/pac-man-party) * balloon-pop (Concept) diff --git a/assets/images/dislike.png b/assets/images/dislike.png new file mode 100644 index 00000000..b5de54fc Binary files /dev/null and b/assets/images/dislike.png differ diff --git a/assets/images/like.png b/assets/images/like.png new file mode 100644 index 00000000..fd6f8b3e Binary files /dev/null and b/assets/images/like.png differ diff --git a/commands/edit-meme/dislike.js b/commands/edit-meme/dislike.js new file mode 100644 index 00000000..bc19a7c5 --- /dev/null +++ b/commands/edit-meme/dislike.js @@ -0,0 +1,61 @@ +const Command = require('../../structures/Command'); +const { createCanvas, loadImage } = require('canvas'); +const request = require('node-superfetch'); +const path = require('path'); + +module.exports = class DislikeCommand extends Command { + constructor(client) { + super(client, { + name: 'dislike', + aliases: ['disliked', 'everyone-disliked-that', 'disliked-that', 'everyone-disliked'], + group: 'edit-meme', + memberName: 'dislike', + description: 'Sends an "Everyone Disliked That" meme with the image of your choice.', + throttling: { + usages: 1, + duration: 10 + }, + clientPermissions: ['ATTACH_FILES'], + credit: [ + { + name: 'Bethesda', + url: 'https://bethesda.net/en/dashboard', + reason: 'Image, Original "Fallout" Game', + reasonURL: 'https://fallout.bethesda.net/en/' + }, + { + 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: 1028 }) + } + ] + }); + } + + async run(msg, { image }) { + try { + const { body } = await request.get(image); + const base = await loadImage(body); + const plate = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'dislike.png')); + const scaleH = plate.width / base.width; + const height = Math.round(base.height * scaleH); + const canvas = createCanvas(plate.width, plate.height + height); + const ctx = canvas.getContext('2d'); + ctx.drawImage(base, 0, 0, plate.width, height); + ctx.drawImage(plate, 0, height + 1); + const attachment = canvas.toBuffer(); + if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); + return msg.say({ files: [{ attachment, name: 'dislike.png' }] }); + } catch (err) { + return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); + } + } +}; diff --git a/commands/edit-meme/like.js b/commands/edit-meme/like.js new file mode 100644 index 00000000..f4361f95 --- /dev/null +++ b/commands/edit-meme/like.js @@ -0,0 +1,61 @@ +const Command = require('../../structures/Command'); +const { createCanvas, loadImage } = require('canvas'); +const request = require('node-superfetch'); +const path = require('path'); + +module.exports = class LikeCommand extends Command { + constructor(client) { + super(client, { + name: 'like', + aliases: ['liked', 'everyone-liked-that', 'liked-that', 'everyone-liked'], + group: 'edit-meme', + memberName: 'like', + description: 'Sends an "Everyone Liked That" meme with the image of your choice.', + throttling: { + usages: 1, + duration: 10 + }, + clientPermissions: ['ATTACH_FILES'], + credit: [ + { + name: 'Bethesda', + url: 'https://bethesda.net/en/dashboard', + reason: 'Image, Original "Fallout" Game', + reasonURL: 'https://fallout.bethesda.net/en/' + }, + { + 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: 1028 }) + } + ] + }); + } + + async run(msg, { image }) { + try { + const { body } = await request.get(image); + const base = await loadImage(body); + const plate = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'like.png')); + const scaleH = plate.width / base.width; + const height = Math.round(base.height * scaleH); + const canvas = createCanvas(plate.width, plate.height + height); + const ctx = canvas.getContext('2d'); + ctx.drawImage(base, 0, 0, plate.width, height); + ctx.drawImage(plate, 0, height + 1); + const attachment = canvas.toBuffer(); + if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); + return msg.say({ files: [{ attachment, name: 'like.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 7507266f..1476f8ba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "114.23.0", + "version": "114.24.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {