sos Command

This commit is contained in:
Dragon Fire
2020-03-11 14:32:02 -04:00
parent 956c3681e9
commit f531f044bc
4 changed files with 72 additions and 2 deletions
+5 -1
View File
@@ -119,7 +119,7 @@ don't grant that permission.
## Commands
Total: 364
Total: 365
### Utility:
@@ -437,6 +437,7 @@ Total: 364
* **nike-ad:** Sends a "Believe in Something" Nike Ad meme with the text of your choice.
* **plankton-plan:** Sends a Plankton's Plan meme with steps of your choice.
* **sora-selfie:** Draws an image or a user's avatar behind Sora taking a selfie.
* **sos:** Sends a "Esther Verkest\'s Help Sign" comic with the text of your choice.
* **spongebob-burn:** Sends a "Spongebob Throwing Something into a Fire" meme with words of your choice.
* **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.
@@ -648,6 +649,8 @@ here.
* hat ([Pirate Hat Image](http://dynamicpickaxe.com/pirate-hat-clipart.html))
- [ebearskittychan](https://twitter.com/ebearskittychan)
* temmie (English-to-Temmie Dictionary Data)
- [Esther Verkest](https://www.facebook.com/Esther-Verkest-49667161749/)
* sos (Image)
- [Face++ Cognitive Services](https://www.faceplusplus.com/)
* face ([Face Detection API](https://www.faceplusplus.com/face-detection/))
- [FANDOM](https://www.fandom.com/)
@@ -690,6 +693,7 @@ here.
* new-password ([Noto Font](https://www.google.com/get/noto/))
* nike-ad ([Noto Font](https://www.google.com/get/noto/))
* plankton-plan ([Noto Font](https://www.google.com/get/noto/))
* sos ([Noto Font](https://www.google.com/get/noto/))
* spongebob-burn ([Noto Font](https://www.google.com/get/noto/))
* book ([Books API](https://developers.google.com/books/))
* google-autofill (Autofill API)
Binary file not shown.

After

Width:  |  Height:  |  Size: 815 KiB

+66
View File
@@ -0,0 +1,66 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage, registerFont } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
const { wrapText } = require('../../util/Canvas');
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
module.exports = class SosCommand extends Command {
constructor(client) {
super(client, {
name: 'sos',
aliases: ['esther-verkest', 'esther', 'help-sign'],
group: 'meme-gen',
memberName: 'sos',
description: 'Sends a "Esther Verkest\'s Help Sign" comic with the text of your choice.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'Esther Verkest',
url: 'https://www.facebook.com/Esther-Verkest-49667161749/',
reason: 'Image'
},
{
name: 'Google',
url: 'https://www.google.com/',
reason: 'Noto Font',
reasonURL: 'https://www.google.com/get/noto/'
}
],
args: [
{
key: 'message',
prompt: 'What should Esther spell out to signal for help?',
type: 'string',
max: 21
}
]
});
}
async run(msg, { message }) {
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'sos.png'));
const canvas = createCanvas(data.width, data.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.font = '35px Noto';
ctx.fillStyle = 'black';
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.rotate(-15 * (Math.PI / 180));
const lines = await wrapText(ctx, message, 130);
ctx.fillText(lines.join('\n'), 362, 522);
ctx.rotate(15 * (Math.PI / 180));
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'sos.png' }] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "112.3.2",
"version": "112.4.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {