That Sign Won't Stop Me Command

This commit is contained in:
Dragon Fire
2020-07-12 09:38:20 -04:00
parent 7ab1b0bfa2
commit 26feccb20a
6 changed files with 97 additions and 2 deletions
+8 -1
View File
@@ -253,7 +253,7 @@ in the appropriate channel's topic to use it.
## Commands
Total: 534
Total: 535
### Utility:
@@ -731,6 +731,7 @@ Total: 534
* **sos:** Sends a "Esther Verkest's Help Sign" comic with the text of your choice.
* **spiderman-pointing:** Sends a "Spiderman Pointing at Spiderman" meme with the text of your choice.
* **spongebob-burn:** Sends a "Spongebob Throwing Something into a Fire" meme with words of your choice.
* **that-sign-wont-stop-me:** Sends a "That Sign Won't Stop Me, I Can't read!" meme with the presentation of your choice.
* **this-guy:** Draws an image or a user's avatar over the "Get a load of this guy" meme.
* **thug-life:** Draws "Thug Life" over an image or a user's avatar.
* **to-be-continued:** Draws an image with the "To Be Continued..." arrow.
@@ -1331,6 +1332,8 @@ here.
* pirate ([English-to-Pirate Dictionary Data](https://github.com/mikewesthad/pirate-speak/blob/master/lib/pirate-speak.js#L1-L155))
- [Minecraft Achievement Generator](https://www.minecraftskinstealer.com/achievement/)
* achievement (Image)
- [Missy Meyer](https://missymeyer.com/)
* that-sign-wont-stop-me ([Tragic Marker Font](https://missymeyer.com/tragic-marker-free-font))
- [Mojang](https://www.mojang.com/)
* achievement ([Original "Minecraft" Game](https://www.minecraft.net/en-us/))
* minecraft-skin ([API, Original "Minecraft" Game](https://wiki.vg/Mojang_API))
@@ -1424,7 +1427,9 @@ here.
* speed-limit (Concept)
* spiderman-pointing (Concept)
* spotify-now-playing (Concept)
* that-sign-wont-stop-me (Concept)
* thicc (Concept)
* tuxedo-pooh (Concept)
* undertale (Concept)
* wild-pokemon (Concept)
* worse-than-hitler (Concept)
@@ -1435,6 +1440,8 @@ here.
* paladins (API)
- [PayPal](https://www.paypal.com/us/home)
* donate (Donation Gathering)
- [PBS Kids](https://pbskids.org/)
* that-sign-wont-stop-me ([Image, Original "Arthur" Show](https://pbskids.org/arthur/))
- [Perspective API](https://www.perspectiveapi.com/#/)
* severe-toxicity (API)
* toxicity (API)
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 535 KiB

@@ -0,0 +1,83 @@
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', 'TragicMarker.otf'), { family: 'Tragic Marker' });
module.exports = class ThatSignWontStopMeCommand extends Command {
constructor(client) {
super(client, {
name: 'that-sign-wont-stop-me',
aliases: ['sign-wont-stop-me', 'i-cant-read', 'because-i-cant-read', 'dw-sign'],
group: 'edit-meme',
memberName: 'lisa-presentation',
description: 'Sends a "That Sign Won\'t Stop Me, I Can\'t read!" meme with the presentation of your choice.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'PBS Kids',
url: 'https://pbskids.org/',
reason: 'Image, Original "Arthur" Show',
reasonURL: 'https://pbskids.org/arthur/'
},
{
name: 'Missy Meyer',
url: 'https://missymeyer.com/',
reason: 'Tragic Marker Font',
reasonURL: 'https://missymeyer.com/tragic-marker-free-font'
},
{
name: 'Overtime2005',
url: 'https://github.com/Overtime2005',
reason: 'Concept'
}
],
args: [
{
key: 'text',
prompt: 'What should the text of the sign be?',
type: 'string',
max: 500
}
]
});
}
async run(msg, { text }) {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'that-sign-wont-stop-me.png'));
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.textAlign = 'center';
ctx.textBaseline = 'top';
ctx.font = '62px Tragic Marker';
let fontSize = 62;
while (ctx.measureText(text).width > 1002) {
fontSize--;
ctx.font = `${fontSize}px Tragic Marker`;
}
const lines = await wrapText(ctx, text, 334);
const topMost = 220 - (((fontSize * lines.length) / 2) + ((10 * (lines.length - 1)) / 2));
for (let i = 0; i < lines.length; i++) {
const height = topMost + ((fontSize + 10) * i);
ctx.fillText(lines[i], 210, height);
}
ctx.font = '16px Tragic Marker';
fontSize = 16;
while (ctx.measureText(text).width > 264) {
fontSize--;
ctx.font = `${fontSize}px Tragic Marker`;
}
const bLines = await wrapText(ctx, text, 88);
const bTopMost = 640 - (((fontSize * bLines.length) / 2) + ((2 * (bLines.length - 1)) / 2));
for (let i = 0; i < bLines.length; i++) {
const height = bTopMost + ((fontSize + 2) * i);
ctx.fillText(bLines[i], 280, height);
}
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'that-sign-wont-stop-me.png' }] });
}
};
+5
View File
@@ -31,6 +31,11 @@ module.exports = class TuxedoPoohCommand extends Command {
url: 'https://www.google.com/',
reason: 'Noto Font',
reasonURL: 'https://www.google.com/get/noto/'
},
{
name: 'Overtime2005',
url: 'https://github.com/Overtime2005',
reason: 'Concept'
}
],
args: [
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "119.15.1",
"version": "119.16.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {