diff --git a/README.md b/README.md index cca42d78..cbfc57e2 100644 --- a/README.md +++ b/README.md @@ -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)) diff --git a/assets/fonts/megaman_zero_dialog.ttf b/assets/fonts/megaman_zero_dialog.ttf new file mode 100644 index 00000000..8fbf384d Binary files /dev/null and b/assets/fonts/megaman_zero_dialog.ttf differ diff --git a/assets/images/zero-dialogue.png b/assets/images/zero-dialogue.png new file mode 100644 index 00000000..4d55d849 Binary files /dev/null and b/assets/images/zero-dialogue.png differ diff --git a/commands/edit-image/zero-dialogue.js b/commands/edit-image/zero-dialogue.js new file mode 100644 index 00000000..edef0724 --- /dev/null +++ b/commands/edit-image/zero-dialogue.js @@ -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' }] }); + } +}; diff --git a/package.json b/package.json index 43c6124a..92a69ca6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "113.15.4", + "version": "113.16.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {