Megaman Zero Dialogue Command

This commit is contained in:
Dragon Fire
2020-04-23 22:11:57 -04:00
parent 0e2cbcf808
commit ecca350ff0
5 changed files with 76 additions and 2 deletions
+6 -1
View File
@@ -132,7 +132,7 @@ in the appropriate channel's topic to use it.
## Commands
Total: 401
Total: 402
### Utility:
@@ -446,6 +446,7 @@ Total: 401
* **silhouette:** Draws a silhouette of an image or a user's avatar.
* **square:** Draws an image or a user's avatar as a square.
* **tint:** Draws an image or a user's avatar but tinted a specific color.
* **zero-dialogue:** Sends a text box from Megaman Zero with the quote of your choice.
### Avatar Manipulation:
@@ -678,6 +679,8 @@ here.
* bulbapedia ([API](https://bulbapedia.bulbagarden.net/w/api.php))
- [Bulletin of the Atomic Scientists](https://thebulletin.org/)
* doomsday-clock ([Doomsday Clock Data](https://thebulletin.org/doomsday-clock/current-time/))
- [Capcom](http://www.capcom.com/us/)
* zero-dialogue ([Image, Original "Megaman Zero" Game](http://megaman.capcom.com/))
- [cheesecakejedi](https://imgur.com/user/cheesecakejedi)
* axis-cult-sign-up ([Image](https://imgur.com/gallery/quQTD))
- [Cheng Xiao](https://www.instagram.com/chengxiao_0715/)
@@ -925,6 +928,8 @@ here.
* mayo-clinic (Disease Data)
- [MDN Web Docs](https://developer.mozilla.org/en-US/)
* mdn (API)
- [Megadreamer](https://www.deviantart.com/megadreamer)
* zero-dialogue ([Megaman Zero Dialogue Font](https://www.deviantart.com/megadreamer/art/Megaman-Zero-dialog-font-513708688))
- [Merriam-Webster's Collegiate® Dictionary](https://www.merriam-webster.com/)
* define ([API](https://dictionaryapi.com/products/api-collegiate-dictionary))
* hangman ([API](https://dictionaryapi.com/products/api-collegiate-dictionary))
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

+69
View File
@@ -0,0 +1,69 @@
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', 'megaman_zero_dialog.ttf'), { family: 'MM Zero' });
module.exports = class ZeroDialogueCommand extends Command {
constructor(client) {
super(client, {
name: 'zero-dialogue',
aliases: [
'megaman-zero-dialogue',
'mm-zero-dialogue',
'zero-dialog',
'megaman-zero-dialog',
'mm-zero-dialog',
'zero-quote',
'megaman-zero-quote',
'mm-zero-quote',
'zero',
'megaman-zero',
'mm-zero'
],
group: 'edit-image',
memberName: 'zero-dialogue',
description: 'Sends a text box from Megaman Zero with the quote of your choice.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'Capcom',
url: 'http://www.capcom.com/us/',
reason: 'Image, Original "Megaman Zero" Game',
reasonURL: 'http://megaman.capcom.com/'
},
{
name: 'Megadreamer',
url: 'https://www.deviantart.com/megadreamer',
reason: 'Megaman Zero Dialogue Font',
reasonURL: 'https://www.deviantart.com/megadreamer/art/Megaman-Zero-dialog-font-513708688'
}
],
args: [
{
key: 'quote',
prompt: 'What should Zero say?',
type: 'string',
max: 50
}
]
});
}
async run(msg, { quote }) {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'zero-dialogue.png'));
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.font = '42px MM Zero';
ctx.fillStyle = 'white';
let text = await wrapText(ctx, quote, 425);
text = text.length > 2 ? `${text.slice(2).join('\n')}...` : text.join('\n');
ctx.fillText(text, 8, 8);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'zero-dialogue.png' }] });
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "113.15.4",
"version": "113.16.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {