diff --git a/README.md b/README.md index f676e02f..6231c2a0 100644 --- a/README.md +++ b/README.md @@ -132,7 +132,7 @@ in the appropriate channel's topic to use it. ## Commands -Total: 405 +Total: 406 ### Utility: @@ -474,6 +474,7 @@ Total: 405 * **3000-years:** Draws an image or a user's avatar over Pokémon's "It's been 3000 years" meme. * **be-like-bill:** Sends a "Be Like Bill" meme with the name of your choice. * **beautiful:** Draws a user's avatar over Gravity Falls' "Oh, this? This is beautiful." meme. +* **catch:** Catch users, revealing who is something. * **challenger:** Draws an image or a user's avatar over Smash Bros.'s "Challenger Approaching" screen. * **cursed-sponge:** Sends a cursed sponge duplicated however many times you want. * **dear-liberals:** Sends a "Dear Liberals" meme with words of your choice. @@ -778,6 +779,7 @@ here. - [Google](https://www.google.com/) * book ([Books API](https://developers.google.com/books/)) * calendar ([Calendar API](https://developers.google.com/calendar/)) + * catch ([Noto Font](https://www.google.com/get/noto/)) * dear-liberals ([Oswald Font](https://fonts.google.com/specimen/Oswald)) * demotivational ([Noto Font](https://www.google.com/get/noto/)) * genie-rules ([Noto Font](https://www.google.com/get/noto/)) diff --git a/assets/images/catch/part-1.png b/assets/images/catch/part-1.png new file mode 100644 index 00000000..240f7e68 Binary files /dev/null and b/assets/images/catch/part-1.png differ diff --git a/assets/images/catch/part-2.png b/assets/images/catch/part-2.png new file mode 100644 index 00000000..5de1c6a5 Binary files /dev/null and b/assets/images/catch/part-2.png differ diff --git a/commands/edit-meme/catch.js b/commands/edit-meme/catch.js new file mode 100644 index 00000000..cafb7a39 --- /dev/null +++ b/commands/edit-meme/catch.js @@ -0,0 +1,64 @@ +const Command = require('../../structures/Command'); +const { createCanvas, loadImage, registerFont } = require('canvas'); +const path = require('path'); +const { delay } = require('../../util/Util'); +registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' }); +registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' }); +registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' }); + +module.exports = class CatchCommand extends Command { + constructor(client) { + super(client, { + name: 'catch', + aliases: ['everyone-caught-is', 'everyone-caught-is-a'], + group: 'edit-meme', + memberName: 'catch', + description: 'Catch users, revealing who is something.', + throttling: { + usages: 1, + duration: 10 + }, + clientPermissions: ['ATTACH_FILES'], + credit: [ + { + name: 'Google', + url: 'https://www.google.com/', + reason: 'Noto Font', + reasonURL: 'https://www.google.com/get/noto/' + } + ], + args: [ + { + key: 'is', + prompt: 'What is everyone who gets caught?', + type: 'string', + max: 15 + }, + { + key: 'time', + prompt: 'How long should I wait before revealing the second half of the image (in seconds)?', + type: 'integer', + max: 60, + min: 1, + default: 30 + } + ] + }); + } + + async run(msg, { is, time }) { + const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'catch', 'part-2.png')); + const canvas = createCanvas(base.width, base.height); + const ctx = canvas.getContext('2d'); + ctx.drawImage(base, 0, 0); + ctx.textBaseline = 'top'; + ctx.fillStyle = 'red'; + ctx.font = '25px Noto'; + ctx.fillText('EVERYONE CAUGHT IS A', 45, 165); + ctx.textAlign = 'center'; + ctx.fillText(is.toUpperCase(), 186, 189); + await msg.channel.send({ files: [path.join(__dirname, '..', '..', 'assets', 'images', 'catch', 'part-1.png')] }); + await delay(time * 1000); + return msg.channel.send({ files: [{ attachment: canvas.toBuffer(), name: 'part-2.png' }] }); + } +}; diff --git a/package.json b/package.json index 8746649b..33dcf49e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "113.19.1", + "version": "113.20.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {