mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Wild Pokemon Command
This commit is contained in:
@@ -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)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
@@ -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!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "117.7.0",
|
||||
"version": "117.8.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user