mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-14 15:57:42 +02:00
Wild Pokemon Pixelized
This commit is contained in:
@@ -2,7 +2,7 @@ const Command = require('../../structures/Command');
|
|||||||
const { createCanvas, loadImage, registerFont } = require('canvas');
|
const { createCanvas, loadImage, registerFont } = require('canvas');
|
||||||
const request = require('node-superfetch');
|
const request = require('node-superfetch');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const { centerImagePart } = require('../../util/Canvas');
|
const { centerImagePart, greyscale } = require('../../util/Canvas');
|
||||||
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'PokemonGb.ttf'), { family: 'Pokemon GB' });
|
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', 'PokemonGbJapanHr.ttf'), { family: 'Pokemon GB' });
|
||||||
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'PokemonGbJapanKt.ttf'), { family: 'Pokemon GB' });
|
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'PokemonGbJapanKt.ttf'), { family: 'Pokemon GB' });
|
||||||
@@ -11,7 +11,7 @@ module.exports = class WildPokemonCommand extends Command {
|
|||||||
constructor(client) {
|
constructor(client) {
|
||||||
super(client, {
|
super(client, {
|
||||||
name: 'wild-pokemon',
|
name: 'wild-pokemon',
|
||||||
aliases: ['wild-pokemon-appears', 'wild-appears', 'wild-pokémon', 'wild-pokémon-appears'],
|
aliases: ['wild-pokemon-appears', 'wild-appears', 'wild-pokémon', 'wild-pokémon-appears', 'wild-pkmn'],
|
||||||
group: 'edit-image',
|
group: 'edit-image',
|
||||||
memberName: 'wild-pokemon',
|
memberName: 'wild-pokemon',
|
||||||
description: 'Draws an image or a user\'s avatar over a wild Pokémon appearance.',
|
description: 'Draws an image or a user\'s avatar over a wild Pokémon appearance.',
|
||||||
@@ -63,8 +63,11 @@ module.exports = class WildPokemonCommand extends Command {
|
|||||||
const canvas = createCanvas(base.width, base.height);
|
const canvas = createCanvas(base.width, base.height);
|
||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
ctx.drawImage(base, 0, 0);
|
ctx.drawImage(base, 0, 0);
|
||||||
|
ctx.imageSmoothingEnabled = false;
|
||||||
const { x, y, width, height } = centerImagePart(data, 100, 100, 227, 11);
|
const { x, y, width, height } = centerImagePart(data, 100, 100, 227, 11);
|
||||||
ctx.drawImage(data, x, y, width, height);
|
ctx.drawImage(data, x, y, width * 0.15, height * 0.15);
|
||||||
|
ctx.drawImage(canvas, x, y, width * 0.15, height * 0.15, x, y, width, height);
|
||||||
|
ctx.imageSmoothingEnabled = true;
|
||||||
ctx.textBaseline = 'top';
|
ctx.textBaseline = 'top';
|
||||||
ctx.font = '16px Pokemon GB';
|
ctx.font = '16px Pokemon GB';
|
||||||
ctx.fillText(name.toUpperCase(), 110, 203, 215);
|
ctx.fillText(name.toUpperCase(), 110, 203, 215);
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "117.9.0",
|
"version": "117.9.1",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user