diff --git a/README.md b/README.md index b3db54b7..42c7d744 100644 --- a/README.md +++ b/README.md @@ -259,7 +259,7 @@ in the appropriate channel's topic to use it. ## Commands -Total: 571 +Total: 572 ### Utility: @@ -661,6 +661,7 @@ Total: 571 * **invert:** Draws an image or a user's avatar but inverted. * **jeopardy-question:** Sends a Jeopardy Question with the text of your choice. * **lego-icon:** Edits an image or avatar onto a character icon from LEGO Star Wars. +* **license-plate:** Creates a license plate with the text of your choice. * **liquid-rescale:** Draws an image or a user's avatar but with liquid rescale from ImageMagick. * **minecraft-skin:** Sends the Minecraft skin for a user. * **mirror:** Draws an image or a user's avatar but mirrored on the X/Y axis (or both). @@ -1062,6 +1063,8 @@ here. * danbooru (API) - [Dance Dance Revolution](https://www.ddrgame.com/) * emoji-emoji-revolution (Concept) +- [Dave Hansen](https://www.fontspace.com/dave-hansen) + * license-plate ([License Plate Font](https://www.fontspace.com/license-plate-font-f3359)) - [Deathbulge](http://deathbulge.com/comics) * ultimate-tattoo ([Image](http://deathbulge.com/comics/114)) - [Demirramon](https://www.demirramon.com/) @@ -1533,6 +1536,8 @@ here. - [Perspective API](https://www.perspectiveapi.com/#/) * severe-toxicity (API) * toxicity (API) +- [Pin Clipart](https://www.pinclipart.com/) + * license-plate ([Image](https://www.pinclipart.com/maxpin/bJxii/)) - [Platinum Designz](http://store.platinumdesignz.com/) * glass-shatter ([Image](https://www.jing.fm/iclipt/u2q8u2a9o0t4i1q8/)) - [Playstation Trophies](https://www.playstationtrophies.org/) diff --git a/assets/fonts/LicensePlate.ttf b/assets/fonts/LicensePlate.ttf new file mode 100644 index 00000000..85457adb Binary files /dev/null and b/assets/fonts/LicensePlate.ttf differ diff --git a/assets/images/license-plate.png b/assets/images/license-plate.png new file mode 100644 index 00000000..a305e0b2 Binary files /dev/null and b/assets/images/license-plate.png differ diff --git a/commands/edit-image/license-plate.js b/commands/edit-image/license-plate.js new file mode 100644 index 00000000..0da0c8dd --- /dev/null +++ b/commands/edit-image/license-plate.js @@ -0,0 +1,55 @@ +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', 'LicensePlate.ttf'), { family: 'License Plate' }); + +module.exports = class LicensePlateCommand extends Command { + constructor(client) { + super(client, { + name: 'license-plate', + group: 'edit-image', + memberName: 'license-plate', + description: 'Creates a license plate with the text of your choice.', + throttling: { + usages: 1, + duration: 10 + }, + clientPermissions: ['ATTACH_FILES'], + credit: [ + { + name: 'Dave Hansen', + url: 'https://www.fontspace.com/dave-hansen', + reason: 'License Plate Font', + reasonURL: 'https://www.fontspace.com/license-plate-font-f3359' + }, + { + name: 'Pin Clipart', + url: 'https://www.pinclipart.com/', + reason: 'Image', + reasonURL: 'https://www.pinclipart.com/maxpin/bJxii/' + } + ], + args: [ + { + key: 'text', + prompt: 'What text should the license plate say?', + type: 'string', + max: 10 + } + ] + }); + } + + async run(msg, { text }) { + const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'license-plate.png')); + const canvas = createCanvas(base.width, base.height); + const ctx = canvas.getContext('2d'); + ctx.drawImage(base, 0, 0); + ctx.textAlign = 'center'; + ctx.textBaseline = 'middle'; + ctx.font = '180px License Plate'; + ctx.fillText(text.toUpperCase(), base.width / 2, base.height / 2, 700); + return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'license-plate.png' }] }); + } +}; diff --git a/package.json b/package.json index 27b9d97f..03c97a66 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "124.1.0", + "version": "124.2.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {