diff --git a/README.md b/README.md index 03c98f37..4384d6e0 100644 --- a/README.md +++ b/README.md @@ -231,7 +231,7 @@ in the appropriate channel's topic to use it. ## Commands -Total: 511 +Total: 512 ### Utility: @@ -618,6 +618,7 @@ Total: 511 * **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. +* **wild-pokemon:** Draws an image or a user's avatar over a wild Pokémon appearance. * **you-died:** Sends a "You Died" screen over an image or a user's avatar. * **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. * **yu-gi-oh-token:** Draws an image or a user's avatar over a blank Yu-Gi-Oh! Token card. @@ -1170,6 +1171,8 @@ here. * guesspionage ([Original "Guesspionage" Game](https://www.jackboxgames.com/guesspionage/)) * lie-swatter ([Original "Lie Swatter" Game](https://www.jackboxgames.com/lie-swatter/)) * word-spud ([Original "Word Spud" Game](https://www.jackboxgames.com/word-spud/)) +- [Jackster Productions](https://www.fontspace.com/jackster-productions) + * wild-pokemon ([Pokemon GB Font](https://www.fontspace.com/pokemon-gb-font-f9621)) - [Jake Clark](https://jake-clark.tumblr.com/) * two-buttons ([Image](https://twitter.com/jakeclarkdude/status/689141113584619524)) - [jasmaa](https://github.com/jasmaa/) @@ -1354,6 +1357,7 @@ here. * speed-limit (Concept) * thicc (Concept) * undertale (Concept) + * wild-pokemon (Concept) * worse-than-hitler (Concept) * you-died (Concept) - [PAC-MAN Party](http://pacman.com/en/pac-man-games/pac-man-party) @@ -1388,6 +1392,7 @@ here. * pokemon-fusion (Original Game) * soundboard (Pikachu Sound) * whos-that-pokemon (Images, Original Game) + * wild-pokemon (Image, Original Game) * wynaut (Image, Original Anime) - [Pornhub](https://www.pornhub.com/) * pornhub (Video Data) diff --git a/assets/fonts/PokemonGb.ttf b/assets/fonts/PokemonGb.ttf new file mode 100644 index 00000000..b5025f06 Binary files /dev/null and b/assets/fonts/PokemonGb.ttf differ diff --git a/assets/fonts/PokemonGbJapanHr.ttf b/assets/fonts/PokemonGbJapanHr.ttf new file mode 100644 index 00000000..72a887f2 Binary files /dev/null and b/assets/fonts/PokemonGbJapanHr.ttf differ diff --git a/assets/fonts/PokemonGbJapanKt.ttf b/assets/fonts/PokemonGbJapanKt.ttf new file mode 100644 index 00000000..d4e0b2fe Binary files /dev/null and b/assets/fonts/PokemonGbJapanKt.ttf differ diff --git a/assets/images/wild-pokemon.png b/assets/images/wild-pokemon.png new file mode 100644 index 00000000..8d5da09e Binary files /dev/null and b/assets/images/wild-pokemon.png differ diff --git a/commands/edit-image/wild-pokemon.js b/commands/edit-image/wild-pokemon.js new file mode 100644 index 00000000..0891576c --- /dev/null +++ b/commands/edit-image/wild-pokemon.js @@ -0,0 +1,76 @@ +const Command = require('../../structures/Command'); +const { createCanvas, loadImage, registerFont } = require('canvas'); +const request = require('node-superfetch'); +const path = require('path'); +const { centerImagePart } = require('../../util/Canvas'); +registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'PokemonGb.ttf'), { family: 'Pokemon GB' }); +registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'PokemonGbJapanHr.ttf'), { family: 'Pokemon GB' }); +registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'PokemonGbJapanKt.ttf'), { family: 'Pokemon GB' }); + +module.exports = class WildPokemonCommand extends Command { + constructor(client) { + super(client, { + name: 'wild-pokemon', + aliases: ['wild-pokemon-appears', 'wild-appears', 'wild-pokémon', 'wild-pokémon-appears'], + group: 'edit-image', + memberName: 'wild-pokemon', + description: 'Draws an image or a user\'s avatar over a wild Pokémon appearance.', + throttling: { + usages: 1, + duration: 10 + }, + clientPermissions: ['ATTACH_FILES'], + credit: [ + { + name: 'Pokémon', + url: 'https://www.pokemon.com/us/', + reason: 'Image, Original Game' + }, + { + name: 'Jackster Productions', + url: 'https://www.fontspace.com/jackster-productions', + reason: 'Pokemon GB Font', + reasonURL: 'https://www.fontspace.com/pokemon-gb-font-f9621' + }, + { + name: 'Overtime2005', + url: 'https://github.com/Overtime2005', + reason: 'Concept' + } + ], + args: [ + { + key: 'name', + prompt: 'What is the name of the Pokémon that should appear?', + type: 'string', + max: 13 + }, + { + key: 'image', + prompt: 'What image would you like to edit?', + type: 'image', + default: msg => msg.author.displayAvatarURL({ format: 'png', size: 128 }) + } + ] + }); + } + + async run(msg, { name, image }) { + try { + const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'wild-pokemon.png')); + const { body } = await request.get(image); + const data = await loadImage(body); + const canvas = createCanvas(base.width, base.height); + const ctx = canvas.getContext('2d'); + ctx.drawImage(base, 0, 0); + const { x, y, width, height } = centerImagePart(data, 100, 100, 227, 11); + ctx.drawImage(data, x, y, width, height); + ctx.textBaseline = 'top'; + ctx.font = '16px Pokemon GB'; + ctx.fillText(name.toUpperCase(), 110, 201, 215); + return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'wild-pokemon.png' }] }); + } catch (err) { + return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); + } + } +}; diff --git a/package.json b/package.json index b3e9cef9..3593e6a2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "117.7.0", + "version": "117.8.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {