Catch Command

This commit is contained in:
Dragon Fire
2020-04-25 10:56:19 -04:00
parent cf9ea36fb7
commit 1849c6a1c7
5 changed files with 68 additions and 2 deletions
+3 -1
View File
@@ -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/))
Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

+64
View File
@@ -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' }] });
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "113.19.1",
"version": "113.20.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {