ELECTRONIC HIGHWAY SIGN

This commit is contained in:
Dragon Fire
2020-05-22 18:31:30 -04:00
parent e95307eef6
commit 1825a57505
5 changed files with 77 additions and 2 deletions
+5 -1
View File
@@ -224,7 +224,7 @@ in the appropriate channel's topic to use it.
## Commands
Total: 433
Total: 434
### Utility:
@@ -534,6 +534,7 @@ Total: 433
* **glass-shatter:** Draws an image or a user's avatar with a glass shatter in front of it.
* **glitch:** Draws an image or a user's avatar but glitched.
* **greyscale:** Draws an image or a user's avatar in greyscale.
* **highway-sign:** Sends a highway sign sign with the text of your choice.
* **hollywood-star:** Sends a Hollywood Walk of Fame star with the name of your choice.
* **ifunny:** Draws an image with the iFunny logo.
* **invert:** Draws an image or a user's avatar but inverted.
@@ -791,10 +792,13 @@ here.
* alert ([San Francisco Font](https://developer.apple.com/fonts/))
* apple-engraving (API)
* itunes ([iTunes Search API](https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api/))
- [Ash Pikachu Font](https://www.dafont.com/ashpikachu099.d2541)
* highway-sign ([Electronic Highway Sign Font](https://www.dafont.com/electronic-highway-sign.font))
- [astrology.TV](https://astrology.tv/)
* horoscope ([Horoscope Data](https://astrology.tv/horoscope/daily/))
- [ATOM.SMASHER.ORG](http://atom.smasher.org/)
* chinese-restaurant ([Image](http://atom.smasher.org/chinese/))
* highway-sign ([Image](http://atom.smasher.org/construction/))
- [Attype Studio](https://www.dafont.com/fadli-ramadhan-iskandar.d7339)
* friendship ([Pinky Cupid Font](https://www.dafont.com/pinky-cupid.font))
* ship ([Pinky Cupid Font](https://www.dafont.com/pinky-cupid.font))
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 483 KiB

+71
View File
@@ -0,0 +1,71 @@
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', 'EHSMB.ttf'), { family: 'Electronic Highway Sign' });
module.exports = class HighwaySignCommand extends Command {
constructor(client) {
super(client, {
name: 'highway-sign',
aliases: ['road-sign', 'road-work-sign', 'electronic-highway-sign'],
group: 'edit-image',
memberName: 'highway-sign',
description: 'Sends a highway sign sign with the text of your choice.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'ATOM.SMASHER.ORG',
url: 'http://atom.smasher.org/',
reason: 'Image',
reasonURL: 'http://atom.smasher.org/construction/'
},
{
name: 'Ash Pikachu Font',
url: 'https://www.dafont.com/ashpikachu099.d2541',
reason: 'Electronic Highway Sign Font',
reasonURL: 'https://www.dafont.com/electronic-highway-sign.font'
}
],
args: [
{
key: 'text',
prompt: 'What should the text of the sign be?',
type: 'string'
}
]
});
}
async run(msg, { text }) {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'highway-sign.png'));
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.fillStyle = '#efe390';
ctx.textAlign = 'center';
ctx.textBaseline = 'top';
ctx.font = '18px Electronic Highway Sign';
const lines = await wrapText(ctx, text.toUpperCase(), 178);
if (lines.length === 1) {
ctx.fillText(lines[0], 89, 109);
} else if (lines.length === 2) {
ctx.fillText(lines[0], 89, 109);
ctx.fillText(lines[1], 89, 128);
} else if (lines.length === 3) {
ctx.fillText(lines[0], 89, 90);
ctx.fillText(lines[1], 89, 109);
ctx.fillText(lines[2], 89, 128);
} else {
ctx.fillText(lines[0], 89, 90);
ctx.fillText(lines[1], 89, 109);
ctx.fillText(lines[2], 89, 128);
ctx.fillText(lines[4], 89, 147);
}
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'highway-sign.png' }] });
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "114.22.0",
"version": "114.23.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {