diff --git a/README.md b/README.md index c9168818..c52af74d 100644 --- a/README.md +++ b/README.md @@ -231,7 +231,7 @@ in the appropriate channel's topic to use it. ## Commands -Total: 513 +Total: 514 ### Utility: @@ -690,6 +690,7 @@ Total: 513 * **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. +* **spiderman-pointing:** Sends a "Spiderman Pointing at Spiderman" meme with the text of your choice. * **spongebob-burn:** Sends a "Spongebob Throwing Something into a Fire" meme with words of your choice. * **this-guy:** Draws an image or a user's avatar over the "Get a load of this guy" meme. * **thug-life:** Draws "Thug Life" over an image or a user's avatar. @@ -1080,6 +1081,7 @@ here. * 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/)) + * spiderman-pointing ([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/)) * steam-now-playing ([Noto Font](https://www.google.com/get/noto/)) @@ -1245,6 +1247,8 @@ here. * box-choosing ([Original Translation](https://store.steampowered.com/app/526490/Higurashi_When_They_Cry_Hou__Ch4_Himatsubushi/)) - [Martin Handford](https://www.candlewick.com/authill.asp?b=Author&m=bio&id=1497&pix=y) * waldo (Original "Where's Wally?" Book Series) +- [Marvel](https://www.marvel.com/) + * spiderman-pointing ([Image, Original "Spiderman" Comic](https://spiderman.marvelhq.com/)) - [Marvelous](http://www.marv.jp/) * give-flower ([Original "Rune Factory 4" Game](http://www.runefactory4.com/index1.html)) * xiao ([Images, Original "Rune Factory 4" Game](http://www.runefactory4.com/index1.html)) @@ -1356,6 +1360,7 @@ here. * simp (Concept) * sonic-says (Concept) * speed-limit (Concept) + * spiderman-pointing (Concept) * thicc (Concept) * undertale (Concept) * wild-pokemon (Concept) diff --git a/assets/images/spiderman-pointing.png b/assets/images/spiderman-pointing.png new file mode 100644 index 00000000..bfd86d7f Binary files /dev/null and b/assets/images/spiderman-pointing.png differ diff --git a/commands/edit-meme/spiderman-pointing.js b/commands/edit-meme/spiderman-pointing.js new file mode 100644 index 00000000..cd162d05 --- /dev/null +++ b/commands/edit-meme/spiderman-pointing.js @@ -0,0 +1,98 @@ +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 SpidermanPointingCommand extends Command { + constructor(client) { + super(client, { + name: 'spiderman-pointing', + aliases: ['spiderman-pointing-at-spiderman', 'spiderman', 'spiderman-point'], + group: 'edit-meme', + memberName: 'spiderman-pointing', + description: 'Sends a "Spiderman Pointing at Spiderman" meme with the text of your choice.', + throttling: { + usages: 1, + duration: 10 + }, + clientPermissions: ['ATTACH_FILES'], + credit: [ + { + name: 'Marvel', + url: 'https://www.marvel.com/', + reason: 'Image, Original "Spiderman" Comic', + reasonURL: 'https://spiderman.marvelhq.com/' + }, + { + name: 'Overtime2005', + url: 'https://github.com/Overtime2005', + reason: 'Concept' + }, + { + name: 'Google', + url: 'https://www.google.com/', + reason: 'Noto Font', + reasonURL: 'https://www.google.com/get/noto/' + } + ], + args: [ + { + key: 'first', + prompt: 'What should the first spiderman be?', + type: 'string', + max: 500 + }, + { + key: 'second', + prompt: 'What should the second spiderman be?', + type: 'string', + max: 500 + } + ] + }); + } + + async run(msg, { first, second }) { + const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'spiderman-pointing.png')); + const canvas = createCanvas(base.width, base.height); + const ctx = canvas.getContext('2d'); + ctx.drawImage(base, 0, 0); + ctx.textAlign = 'center'; + ctx.textBaseline = 'top'; + ctx.font = '50px Noto'; + ctx.fillStyle = 'white'; + let fontSize = 50; + while (ctx.measureText(first).width > 725) { + fontSize--; + ctx.font = `${fontSize}px Noto`; + } + const lines = await wrapText(ctx, first, 290); + const topMost = 189 - (((fontSize * lines.length) / 2) + ((10 * (lines.length - 1)) / 2)); + for (let i = 0; i < lines.length; i++) { + ctx.strokeStyle = 'black'; + ctx.lineWidth = 5; + const height = topMost + ((fontSize + 10) * i); + ctx.strokeText(lines[i], 222, height); + ctx.fillText(lines[i], 222, height); + } + ctx.font = '50px Noto'; + fontSize = 50; + while (ctx.measureText(second).width > 725) { + fontSize--; + ctx.font = `${fontSize}px Noto`; + } + const lines = await wrapText(ctx, second, 290); + const topMost = 190 - (((fontSize * lines.length) / 2) + ((10 * (lines.length - 1)) / 2)); + for (let i = 0; i < lines.length; i++) { + ctx.strokeStyle = 'black'; + ctx.lineWidth = 5; + const height = topMost + ((fontSize + 10) * i); + ctx.strokeText(lines[i], 596, height); + ctx.fillText(lines[i], 596, height); + } + return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'spiderman-pointing.png' }] }); + } +}; diff --git a/package.json b/package.json index 29c8812e..e2bef80d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "117.9.1", + "version": "117.10.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {