License Plate Command

This commit is contained in:
Dragon Fire
2020-12-16 16:55:45 -05:00
parent 2ee2e82200
commit 1d5f6c7088
5 changed files with 62 additions and 2 deletions
+6 -1
View File
@@ -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/)
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 179 KiB

+55
View File
@@ -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' }] });
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "124.1.0",
"version": "124.2.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {