diff --git a/README.md b/README.md index fe81ea13..80f8edba 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/assets/fonts/Oswald-SemiBold.ttf b/assets/fonts/Oswald-SemiBold.ttf new file mode 100644 index 00000000..bb3ef26c Binary files /dev/null and b/assets/fonts/Oswald-SemiBold.ttf differ diff --git a/assets/images/dear-liberals.png b/assets/images/dear-liberals.png new file mode 100644 index 00000000..6494aa55 Binary files /dev/null and b/assets/images/dear-liberals.png differ diff --git a/commands/meme-gen/dear-liberals.js b/commands/meme-gen/dear-liberals.js new file mode 100644 index 00000000..80106e4b --- /dev/null +++ b/commands/meme-gen/dear-liberals.js @@ -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' }] }); + } +}; diff --git a/package.json b/package.json index 3257a9df..74fc4cb2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "109.3.4", + "version": "109.4.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {