Chi Idea Command

This commit is contained in:
Dragon Fire
2020-05-07 18:45:20 -04:00
parent 3582946e81
commit f8b1b27470
5 changed files with 81 additions and 2 deletions
+8 -1
View File
@@ -136,7 +136,7 @@ in the appropriate channel's topic to use it.
## Commands
Total: 415
Total: 416
### Utility:
@@ -483,6 +483,7 @@ Total: 415
* **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.
* **chi-idea:** Sends a "Daddy, I've got an idea!" Takagi-san meme with the text of your choice.
* **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.
@@ -891,6 +892,8 @@ here.
* wave ([API](https://apidocs.imgur.com/))
* wink ([API](https://apidocs.imgur.com/))
* xiao ([API](https://apidocs.imgur.com/))
- [Inside Scanlation](https://www.insidescanlation.com/)
* chi-idea ([Wild Words Font](https://www.insidescanlation.com/etc/the-idiots-guide-to-editing-manga/guide/type/fonts.html))
- [ipify API](https://www.ipify.org/)
* ip (API)
- [Jack The Awesomeness Gamer](https://www.youtube.com/channel/UCIeA23B91hAeR1UuC2VDSdQ)
@@ -1159,6 +1162,8 @@ here.
* fishy (Concept)
* phone (Concept)
* psycho-pass (Concept)
- [Teasing Master Takagi-san](https://takagi3.me/)
* chi-idea (Original "Teasing Master Takagi-san" Manga)
- [Tenor](https://tenor.com/)
* tenor ([API](https://tenor.com/gifapi/documentation))
- [The Internet Chuck Norris Database](http://www.icndb.com/)
@@ -1196,6 +1201,8 @@ here.
* sorting-hat ([Sorting Hat Quiz Analysis Data](https://www.reddit.com/r/Pottermore/comments/44os14/pottermore_sorting_hat_quiz_analysis/))
- [u/SupremeMemesXD](https://www.reddit.com/user/SupremeMemesXD/)
* girl-worth-fighting-for ([Image](https://www.reddit.com/r/MemeTemplatesOfficial/comments/8h39vi/girl_worth_fighting_for_template/))
- [u/THANOS_COPTER](https://www.reddit.com/user/THANOS_COPTER/)
* chi-idea ([Image](https://www.reddit.com/r/Takagi_san/comments/gb4wdt/how_far_is_too_far/))
- [u/Two-Tone-](https://www.reddit.com/user/Two-Tone-/)
* genie-rules ([Image](https://www.reddit.com/r/MemeTemplatesOfficial/comments/bht9o6/i_made_an_hd_high_quality_version_of_the_4_rules/))
- [UNDERTALE](https://undertale.com/)
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 355 KiB

+72
View File
@@ -0,0 +1,72 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'wildwordsroman.ttf'), { family: 'Wild Words' });
module.exports = class ChiIdeaCommand extends Command {
constructor(client) {
super(client, {
name: 'chi-idea',
aliases: ['idea', 'takagi-idea', 'i-have-an-idea'],
group: 'edit-meme',
memberName: 'chi-idea',
description: 'Sends a "Daddy, I\'ve got an idea!" Takagi-san meme with the text of your choice.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'u/THANOS_COPTER',
url: 'https://www.reddit.com/user/THANOS_COPTER/',
reason: 'Image',
reasonURL: 'https://www.reddit.com/r/Takagi_san/comments/gb4wdt/how_far_is_too_far/'
},
{
name: 'Teasing Master Takagi-san',
url: 'https://takagi3.me/',
reason: 'Original "Teasing Master Takagi-san" Manga'
},
{
name: 'Inside Scanlation',
url: 'https://www.insidescanlation.com/',
reason: 'Wild Words Font',
// eslint-disable-next-line max-len
reasonURL: 'https://www.insidescanlation.com/etc/the-idiots-guide-to-editing-manga/guide/type/fonts.html'
}
],
args: [
{
key: 'text',
prompt: 'What is Chi\'s idea?',
type: 'string',
max: 100
}
]
});
}
async run(msg, { text }) {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'chi-idea.png'));
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.textAlign = 'center';
ctx.textBaseline = 'top';
ctx.font = '15px Wild Words';
let fontSize = 15;
while (ctx.measureText(text).width > 500) {
fontSize -= 1;
ctx.font = `${fontSize}px Wild Words`;
}
const lines = await wrapText(ctx, text, 83);
const topMost = 137 - (((fontSize * lines.length) / 2) + ((5 * (lines.length - 1)) / 2));
for (let i = 0; i < lines.length; i++) {
const height = topMost + ((fontSize + 5) * i);
ctx.fillText(lines[i], 70, height);
}
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'chi-idea.png' }] });
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "114.7.3",
"version": "114.8.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {