Dear Liberals Command

This commit is contained in:
Dragon Fire
2019-12-18 16:11:53 -05:00
parent 7ca4195b8b
commit e6cb007b42
5 changed files with 81 additions and 2 deletions
+2 -1
View File
@@ -55,7 +55,7 @@ Xiao is a Discord bot coded in JavaScript with
* [Rando Cardrissian](https://github.com/dragonfire535/rando-cardrissian) is a Cards Against Humanity bot, whose features were originally built into Xiao.
## Commands (348)
## Commands (349)
### Utility:
* **eval:** Executes JavaScript code.
@@ -348,6 +348,7 @@ Xiao is a Discord bot coded in JavaScript with
* **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.
* **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.
* **distracted-boyfriend:** Draws three user's avatars over the "Distracted Boyfriend" meme.
* **drakeposting:** Draws two user's avatars over the "Drakeposting" meme.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 201 KiB

+78
View File
@@ -0,0 +1,78 @@
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', 'Oswald-SemiBold.ttf'), { family: 'Oswald' });
module.exports = class DearLiberalsCommand extends Command {
constructor(client) {
super(client, {
name: 'dear-liberals',
aliases: ['turning-point-usa', 'ben-shapiro'],
group: 'meme-gen',
memberName: 'dear-liberals',
description: 'Sends a "Dear Liberals" meme with words of your choice.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'Turning Point USA',
url: 'https://www.tpusa.com/'
},
{
name: 'Oswald Font',
url: 'https://fonts.google.com/specimen/Oswald'
}
],
args: [
{
key: 'hashtag',
prompt: 'What hashtag should be on Ben Shapiro\'s sign? No spaces or symbols.',
type: 'string',
max: 10,
validate: hashtag => /^[A-Z0-9]+$/i.test(hashtag)
},
{
key: 'blueText',
label: 'blue text',
prompt: 'What should the blue text be?',
type: 'string',
max: 42,
parse: blueText => blueText.toUpperCase()
},
{
key: 'redText',
label: 'red text',
prompt: 'What should the red text be?',
type: 'string',
max: 24,
parse: redText => redText.toUpperCase()
}
]
});
}
async run(msg, { hashtag, blueText, redText }) {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'dear-liberals.png'));
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.fillStyle = 'white';
ctx.textBaseline = 'top';
ctx.font = '20px Oswald-SemiBold';
ctx.rotate(-12.30 * (Math.PI / 180));
ctx.filltext(`#${hashtag}`, 136, 275);
ctx.rotate(12.30 * (Math.PI / 180));
ctx.fillStyle = '#002046';
ctx.font = '27px Oswald-SemiBold';
const blueLines = await wrapText(ctx, blueText, 270);
ctx.fillText(blueLines.join('\n'), 207, 90);
ctx.fillStyle = '#c31a41';
const redLines = await wrapText(ctx, redText, 165);
ctx.fillText(redLines.join('\n'), 326, 236);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'dear-liberals.png' }] });
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "109.3.4",
"version": "109.4.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {