diff --git a/README.md b/README.md index 3ed0c1b5..7c776b18 100644 --- a/README.md +++ b/README.md @@ -227,7 +227,7 @@ in the appropriate channel's topic to use it. ## Commands -Total: 478 +Total: 479 ### Utility: @@ -595,6 +595,7 @@ Total: 478 * **subtitle:** Adds subtitles to an image. * **tint:** Draws an image or a user's avatar but tinted a specific color. * **tweet:** Sends a Twitter tweet with the user and text of your choice. +* **undertale:** Sends a text box from Undertale with the quote and character of your choice. * **yu-gi-oh-gen:** Draws an image or a user's avatar on a Yu-Gi-Oh! Trading Card with the text of your choice. * **zero-dialogue:** Sends a text box from Megaman Zero with the quote of your choice. @@ -883,6 +884,8 @@ here. - [Capcom](http://www.capcom.com/us/) * ace-attorney ([Images, Original "Ace Attorney" Game](http://www.ace-attorney.com/)) * zero-dialogue ([Image, Original "Megaman Zero" Game](http://megaman.capcom.com/)) +- [Carter Sande](https://gitlab.com/cartr) + * undertale ([Fonts](https://gitlab.com/cartr/undertale-fonts/tree/master)) - [Cartoon Network](https://www.cartoonnetworkme.com/) * edd-facts-book ([Image, Original "Ed, Edd n Eddy" TV Series](https://www.cartoonnetworkme.com/show/ed-edd-n-eddy)) - [cheesecakejedi](https://imgur.com/user/cheesecakejedi) @@ -918,6 +921,8 @@ here. * emoji-emoji-revolution (Concept) - [Deathbulge](http://deathbulge.com/comics) * ultimate-tattoo ([Image](http://deathbulge.com/comics/114)) +- [Demirramon](https://www.demirramon.com/) + * undertale ([Images](https://www.demirramon.com/en/generators/undertale_text_box_generator)) - [Derpibooru](https://derpibooru.org/) * derpibooru ([API](https://www.derpibooru.org/pages/api)) - [DeviantArt](https://www.deviantart.com/) @@ -1273,6 +1278,7 @@ here. * pogchamp (Concept) * porn (Original Subreddit List) * simp (Concept) + * undertale (Concept) * worse-than-hitler (Concept) - [PAC-MAN Party](http://pacman.com/en/pac-man-games/pac-man-party) * balloon-pop (Concept) @@ -1473,6 +1479,7 @@ here. * genie-rules ([Image](https://www.reddit.com/r/MemeTemplatesOfficial/comments/bht9o6/i_made_an_hd_high_quality_version_of_the_4_rules/)) - [UNDERTALE](https://undertale.com/) * temmie (Original Game) + * undertale (Original Game) - [Unsplash](https://unsplash.com/) * stock-photo ([API](https://unsplash.com/developers)) - [Urban Dictionary](https://www.urbandictionary.com/) diff --git a/assets/fonts/DeterminationMono.ttf b/assets/fonts/DeterminationMono.ttf new file mode 100644 index 00000000..4a87da37 Binary files /dev/null and b/assets/fonts/DeterminationMono.ttf differ diff --git a/assets/fonts/UndertalePapyrus.ttf b/assets/fonts/UndertalePapyrus.ttf new file mode 100644 index 00000000..3637ec08 Binary files /dev/null and b/assets/fonts/UndertalePapyrus.ttf differ diff --git a/assets/fonts/UndertaleSans.ttf b/assets/fonts/UndertaleSans.ttf new file mode 100644 index 00000000..c082523b Binary files /dev/null and b/assets/fonts/UndertaleSans.ttf differ diff --git a/assets/images/undertale/alphys.png b/assets/images/undertale/alphys.png new file mode 100644 index 00000000..40cccefc Binary files /dev/null and b/assets/images/undertale/alphys.png differ diff --git a/assets/images/undertale/asgore.png b/assets/images/undertale/asgore.png new file mode 100644 index 00000000..d58c0b76 Binary files /dev/null and b/assets/images/undertale/asgore.png differ diff --git a/assets/images/undertale/chara.png b/assets/images/undertale/chara.png new file mode 100644 index 00000000..0929e2d8 Binary files /dev/null and b/assets/images/undertale/chara.png differ diff --git a/assets/images/undertale/flowey.png b/assets/images/undertale/flowey.png new file mode 100644 index 00000000..34fa105c Binary files /dev/null and b/assets/images/undertale/flowey.png differ diff --git a/assets/images/undertale/ghost.png b/assets/images/undertale/ghost.png new file mode 100644 index 00000000..c73dc82a Binary files /dev/null and b/assets/images/undertale/ghost.png differ diff --git a/assets/images/undertale/papyrus.png b/assets/images/undertale/papyrus.png new file mode 100644 index 00000000..07a5b6e3 Binary files /dev/null and b/assets/images/undertale/papyrus.png differ diff --git a/assets/images/undertale/sans.png b/assets/images/undertale/sans.png new file mode 100644 index 00000000..afaeb531 Binary files /dev/null and b/assets/images/undertale/sans.png differ diff --git a/assets/images/undertale/temmie.png b/assets/images/undertale/temmie.png new file mode 100644 index 00000000..b203c533 Binary files /dev/null and b/assets/images/undertale/temmie.png differ diff --git a/assets/images/undertale/toriel.png b/assets/images/undertale/toriel.png new file mode 100644 index 00000000..c02af402 Binary files /dev/null and b/assets/images/undertale/toriel.png differ diff --git a/assets/images/undertale/undyne.png b/assets/images/undertale/undyne.png new file mode 100644 index 00000000..6ac2d84b Binary files /dev/null and b/assets/images/undertale/undyne.png differ diff --git a/assets/json/undertale.json b/assets/json/undertale.json new file mode 100644 index 00000000..4c4cac8e --- /dev/null +++ b/assets/json/undertale.json @@ -0,0 +1,12 @@ +[ + "alphys", + "asgore", + "chara", + "flowey", + "ghost", + "papyrus", + "sans", + "temmie", + "toriel", + "undyne" +] diff --git a/commands/edit-image/undertale.js b/commands/edit-image/undertale.js new file mode 100644 index 00000000..ec355c2a --- /dev/null +++ b/commands/edit-image/undertale.js @@ -0,0 +1,99 @@ +const Command = require('../../structures/Command'); +const { createCanvas, loadImage, registerFont } = require('canvas'); +const path = require('path'); +const { firstUpperCase, list } = require('../../util/Util'); +const { wrapText } = require('../../util/Canvas'); +const characters = require('../../assets/json/undertale'); +registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'DeterminationMono.ttf'), { + family: 'DeterminationMono' +}); +registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'UndertalePapyrus.ttf'), { + family: 'UndertalePapyrus' +}); +registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'UndertaleSans.ttf'), { family: 'UndertaleSans' }); + +module.exports = class UndertaleCommand extends Command { + constructor(client) { + super(client, { + name: 'undertale', + aliases: [ + 'ut', + 'undertale-dialogue', + 'ut-dialogue', + 'undertale-dialog', + 'ut-dialog', + 'undertale-quote', + 'ut-quote' + ], + group: 'edit-image', + memberName: 'undertale', + description: 'Sends a text box from Undertale with the quote and character of your choice.', + throttling: { + usages: 1, + duration: 10 + }, + clientPermissions: ['ATTACH_FILES'], + credit: [ + { + name: 'UNDERTALE', + url: 'https://undertale.com/', + reason: 'Original Game' + }, + { + name: 'Demirramon', + url: 'https://www.demirramon.com/', + reason: 'Images', + reasonURL: 'https://www.demirramon.com/en/generators/undertale_text_box_generator' + }, + { + name: 'Carter Sande', + url: 'https://gitlab.com/cartr', + reason: 'Fonts', + reasonURL: 'https://gitlab.com/cartr/undertale-fonts/tree/master' + }, + { + name: 'Overtime2005', + url: 'https://github.com/Overtime2005', + reason: 'Concept' + } + ], + args: [ + { + key: 'character', + prompt: `What character do you want to use? Either ${list(characters, 'or')}.`, + type: 'string', + oneOf: characters, + parse: character => character.toLowerCase() + }, + { + key: 'quote', + prompt: 'What should the character say?', + type: 'string', + max: 250 + } + ] + }); + } + + async run(msg, { character, quote }) { + const base = await loadImage( + path.join(__dirname, '..', '..', 'assets', 'images', 'undertale', `${character}.png`) + ); + const canvas = createCanvas(base.width, base.height); + const ctx = canvas.getContext('2d'); + ctx.drawImage(base, 0, 0); + let font; + switch (character) { + case 'sans': font = 'UndertaleSans'; break; + case 'papyrus': font = 'UndertalePapyrus'; break; + default: font = 'DeterminationMono'; break; + } + ctx.font = `20px ${font}`; + ctx.fillStyle = 'white'; + ctx.textBaseline = 'top'; + let text = await wrapText(ctx, quote, 385); + text = text.length > 3 ? `${text.slice(0, 3).join('\n')}...` : text.join('\n'); + ctx.fillText(text, 176, 28); + return msg.say({ files: [{ attachment: canvas.toBuffer(), name: `undertale-${character}.png` }] }); + } +}; diff --git a/package.json b/package.json index 87ff2153..7974e9e3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "116.21.1", + "version": "116.22.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {