diff --git a/README.md b/README.md index 852ca240..a211f711 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,7 @@ don't grant that permission. ## Commands -Total: 381 +Total: 382 ### Utility: @@ -391,6 +391,7 @@ Total: 381 * **apple-engraving:** Engraves the text of your choice onto an Apple product. * **approved:** Draws an "approved" stamp over an image or a user's avatar. * **axis-cult-sign-up:** Sends an Axis Cult Sign-Up sheet for you. Join today! +* **bart-chalkboard:** Sends a "Bart Chalkboard" meme with the text of your choice. * **brazzers:** Draws an image with the Brazzers logo in the corner. (NSFW) * **circle:** Draws an image or a user's avatar as a circle. * **color:** Sends an image of the color you choose. @@ -798,6 +799,8 @@ here. * jisho (API) - [JoJo's Bizzare Adventure](http://www.araki-jojo.com/) * to-be-continued (Original Anime) +- [Jon Bernhardt](http://web.mit.edu/jonb/www/) + * bart-chalkboard ([Akbar Font](https://www.wobblymusic.com/groening/akbar.html)) - [Kickstarter](https://www.kickstarter.com/) * kickstarter (API) - [KINMOZA!](http://www.kinmosa.com/) diff --git a/assets/fonts/akbar.ttf b/assets/fonts/akbar.ttf new file mode 100644 index 00000000..b6f9e5db Binary files /dev/null and b/assets/fonts/akbar.ttf differ diff --git a/assets/images/bart-chalkboard.png b/assets/images/bart-chalkboard.png new file mode 100644 index 00000000..96618fef Binary files /dev/null and b/assets/images/bart-chalkboard.png differ diff --git a/commands/meme-gen/bart-chalkboard.js b/commands/meme-gen/bart-chalkboard.js new file mode 100644 index 00000000..adad3f7d --- /dev/null +++ b/commands/meme-gen/bart-chalkboard.js @@ -0,0 +1,55 @@ +const Command = require('../../structures/Command'); +const { createCanvas, loadImage, registerFont } = require('canvas'); +const path = require('path'); +const { shortenText } = require('../../util/Canvas'); +registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'akbar.ttf'), { family: 'Akbar' }); + +module.exports = class LisaPresentationCommand extends Command { + constructor(client) { + super(client, { + name: 'bart-chalkboard', + aliases: ['bart'], + group: 'meme-gen', + memberName: 'bart-chalkboard', + description: 'Sends a "Bart Chalkboard" meme with the text of your choice.', + throttling: { + usages: 1, + duration: 10 + }, + clientPermissions: ['ATTACH_FILES'], + credit: [ + { + name: '20th Century Fox', + url: 'https://www.foxmovies.com/', + reason: 'Image, Original "The Simpsons" Show', + reasonURL: 'http://www.simpsonsworld.com/' + }, + { + name: 'Jon Bernhardt', + url: 'http://web.mit.edu/jonb/www/', + reason: 'Akbar Font', + reasonURL: 'https://www.wobblymusic.com/groening/akbar.html' + } + ], + args: [ + { + key: 'text', + prompt: 'What should the text on the chalkboard be?', + type: 'string', + max: 50 + } + ] + }); + } + + async run(msg, { text }) { + const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'bart-chalkboard.png')); + const canvas = createCanvas(base.width, base.height); + const ctx = canvas.getContext('2d'); + ctx.drawImage(base, 0, 0); + ctx.textAlign = 'top'; + ctx.font = '19px Akbar'; + ctx.fillText(shortenText(ctx, `${text}\n`.repeat(12).trim(), 500), 30, 27); + return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'bart-chalkboard.png' }] }); + } +}; diff --git a/package.json b/package.json index 4d92547c..852d30c4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "112.18.2", + "version": "112.19.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {