diff --git a/README.md b/README.md index 37348c23..fa37af95 100644 --- a/README.md +++ b/README.md @@ -227,7 +227,7 @@ in the appropriate channel's topic to use it. ## Commands -Total: 502 +Total: 503 ### Utility: @@ -673,6 +673,7 @@ Total: 502 * **pogchamp:** Sends a pogchamp duplicated however many times you want. * **scroll-of-truth:** Sends a "Scroll of Truth" meme with the text of your choice. * **skyrim-skill:** Sends a "Skyrim Skill" meme with the skill and image of your choice. +* **sonic-says:** Sends a "Sonic Says" meme with the quote 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. @@ -1060,6 +1061,7 @@ here. * pills ([Noto Font](https://www.google.com/get/noto/)) * plankton-plan ([Noto Font](https://www.google.com/get/noto/)) * scroll-of-truth ([Noto Font](https://www.google.com/get/noto/)) + * sonic-says ([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/)) * steam-card ([Noto Font](https://www.google.com/get/noto/)) @@ -1326,6 +1328,7 @@ here. * pogchamp (Concept) * porn (Original Subreddit List) * simp (Concept) + * sonic-says (Concept) * speed-limit (Concept) * thicc (Concept) * undertale (Concept) @@ -1425,6 +1428,8 @@ here. * pogchamp (Image) - [Safebooru](https://safebooru.org/) * safebooru (API) +- [SEGA](https://www.sega.com/) + * sonic-says ([Image, Original "Sonic the Hedgehog" Game](https://www.sonicthehedgehog.com/)) - [Serebii.net](https://www.serebii.net/index2.shtml) * pokedex (Images) * whos-that-pokemon (Images) diff --git a/assets/images/sonic-says.png b/assets/images/sonic-says.png new file mode 100644 index 00000000..d1219fb5 Binary files /dev/null and b/assets/images/sonic-says.png differ diff --git a/commands/edit-meme/sonic-says.js b/commands/edit-meme/sonic-says.js new file mode 100644 index 00000000..436fa11d --- /dev/null +++ b/commands/edit-meme/sonic-says.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', '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 SonicSaysCommand extends Command { + constructor(client) { + super(client, { + name: 'sonic-says', + aliases: ['sonic-say', 'sonic'], + group: 'edit-meme', + memberName: 'sonic-says', + description: 'Sends a "Sonic Says" meme with the quote of your choice.', + throttling: { + usages: 1, + duration: 10 + }, + clientPermissions: ['ATTACH_FILES'], + credit: [ + { + name: 'Google', + url: 'https://www.google.com/', + reason: 'Noto Font', + reasonURL: 'https://www.google.com/get/noto/' + }, + { + name: 'SEGA', + url: 'https://www.sega.com/', + reason: 'Image, Original "Sonic the Hedgehog" Game', + reasonURL: 'https://www.sonicthehedgehog.com/' + }, + { + name: 'Overtime2005', + url: 'https://github.com/Overtime2005', + reason: 'Concept' + } + ], + args: [ + { + key: 'text', + prompt: 'What should Sonic say?', + type: 'string', + max: 500 + } + ] + }); + } + + async run(msg, { text }) { + const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'sonic-says.png')); + const canvas = createCanvas(base.width, base.height); + const ctx = canvas.getContext('2d'); + ctx.textBaseline = 'top'; + ctx.drawImage(base, 0, 0); + ctx.font = '26px Noto'; + let fontSize = 26; + while (ctx.measureText(text).width > 648) { + fontSize--; + ctx.font = `${fontSize}px Noto`; + } + const lines = await wrapText(ctx, text, 185); + ctx.fillStyle = 'white'; + ctx.fillText(lines.join('\n'), 92, 67, 185); + return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'sonic-says.png' }] }); + } +}; diff --git a/package.json b/package.json index 17f2a609..18307670 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "116.39.0", + "version": "116.40.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {