mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Yu-Gi-Oh! Gen Command
This commit is contained in:
@@ -227,7 +227,7 @@ in the appropriate channel's topic to use it.
|
||||
|
||||
## Commands
|
||||
|
||||
Total: 476
|
||||
Total: 477
|
||||
|
||||
### Utility:
|
||||
|
||||
@@ -594,6 +594,7 @@ Total: 476
|
||||
* **subtitle:** Adds subtitles to an image.
|
||||
* **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.
|
||||
* **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.
|
||||
* **zero-dialogue:** Sends a text box from Megaman Zero with the quote of your choice.
|
||||
|
||||
### Avatar Manipulation:
|
||||
@@ -874,6 +875,8 @@ here.
|
||||
* doomsday-clock ([Doomsday Clock Data](https://thebulletin.org/doomsday-clock/current-time/))
|
||||
- [bunnies.io](https://www.bunnies.io/)
|
||||
* bunny (API)
|
||||
- [bushin](https://www.cardmaker.net/profile/220983-bushin/)
|
||||
* yu-gi-oh-gen ([Fonts](https://www.cardmaker.net/forums/topic/308603-fonts-for-yu-gi-oh-card-making-with-multilingual-support/))
|
||||
- [calzoneman](https://github.com/calzoneman)
|
||||
* dec-talk ([API](https://github.com/calzoneman/aeiou))
|
||||
- [Capcom](http://www.capcom.com/us/)
|
||||
@@ -906,6 +909,8 @@ here.
|
||||
* cow-say (API)
|
||||
- [Creative Certificates](https://www.creativecertificates.com/)
|
||||
* certificate ([Image](https://www.creativecertificates.com/award-certificate-templates/))
|
||||
- [cylgom](https://www.deviantart.com/cylgom)
|
||||
* yu-gi-oh-gen ([Card Base Template](https://www.deviantart.com/cylgom/art/Yu-GI-Oh-ultra-faithful-monster-card-template-728814822))
|
||||
- [Danbooru](https://danbooru.donmai.us/)
|
||||
* danbooru (API)
|
||||
- [Dance Dance Revolution](https://www.ddrgame.com/)
|
||||
@@ -1059,6 +1064,8 @@ here.
|
||||
* rip ([Coffin Stone Font](https://www.fontspace.com/coffin-stone-font-f40998))
|
||||
- [iCrawl](https://github.com/iCrawl)
|
||||
* butt ([Code, Concept](https://github.com/iCrawl/Tohru/blob/master/src/commands/fun/butts.js))
|
||||
- [icycatelf](https://www.deviantart.com/icycatelf)
|
||||
* yu-gi-oh-gen ([Level Star Image](https://www.deviantart.com/icycatelf/art/Level-Star-Template-PSD-607344453))
|
||||
- [iFunny](https://ifunny.co/)
|
||||
* ifunny (Logo)
|
||||
- [Illumination](http://www.illumination.com/)
|
||||
@@ -1136,6 +1143,7 @@ here.
|
||||
* look-what-karen-have ([Image](https://knowyourmeme.com/photos/1047091-kin-iro-mosaic-kinmoza))
|
||||
- [Konami](https://www.konami.com/en/)
|
||||
* yu-gi-oh ([Original "Yu-Gi-Oh!" Game](https://www.yugioh-card.com/en/))
|
||||
* yu-gi-oh-gen ([Images, Original "Yu-Gi-Oh!" Game](https://www.yugioh-card.com/en/))
|
||||
* yu-gi-oh-token ([Image, Original "Yu-Gi-Oh!" Game](https://www.yugioh-card.com/en/))
|
||||
- [KONOSUBA -God's blessing on this wonderful world!](http://konosuba.com/)
|
||||
* axis-cult (Original Anime)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 8.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@@ -0,0 +1,132 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { createCanvas, loadImage, registerFont } = require('canvas');
|
||||
const request = require('node-superfetch');
|
||||
const path = require('path');
|
||||
const { wrapText } = require('../../util/Canvas');
|
||||
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Matrix Book.ttf'), { family: 'Matrix Book' });
|
||||
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Matrix Small Caps.ttf'), { family: 'Matrix' });
|
||||
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Stone Serif Semibold.ttf'), {
|
||||
family: 'Stone Serif',
|
||||
weight: 'semibold'
|
||||
});
|
||||
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Stone Serif Small Caps.ttf'), {
|
||||
family: 'Stone Serif',
|
||||
weight: 'smallcaps'
|
||||
});
|
||||
|
||||
module.exports = class YuGiOhGenCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'yu-gi-oh-gen',
|
||||
aliases: ['ygo-gen', 'yu-gi-oh-generator', 'ygo-generator'],
|
||||
group: 'edit-image',
|
||||
memberName: 'yu-gi-oh-gen',
|
||||
description: 'Draws an image or a user\'s avatar on a Yu-Gi-Oh! Trading Card with the text of your choice.',
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 10
|
||||
},
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
credit: [
|
||||
{
|
||||
name: 'Konami',
|
||||
url: 'https://www.konami.com/en/',
|
||||
reason: 'Images, Original "Yu-Gi-Oh!" Game',
|
||||
reasonURL: 'https://www.yugioh-card.com/en/'
|
||||
},
|
||||
{
|
||||
name: 'cylgom',
|
||||
url: 'https://www.deviantart.com/cylgom',
|
||||
reason: 'Card Base Template',
|
||||
reasonURL: 'https://www.deviantart.com/cylgom/art/Yu-GI-Oh-ultra-faithful-monster-card-template-728814822'
|
||||
},
|
||||
{
|
||||
name: 'icycatelf',
|
||||
url: 'https://www.deviantart.com/icycatelf',
|
||||
reason: 'Level Star Image',
|
||||
reasonURL: 'https://www.deviantart.com/icycatelf/art/Level-Star-Template-PSD-607344453'
|
||||
},
|
||||
{
|
||||
name: 'bushin',
|
||||
url: 'https://www.cardmaker.net/profile/220983-bushin/',
|
||||
reason: 'Fonts',
|
||||
// eslint-disable-next-line max-len
|
||||
reasonURL: 'https://www.cardmaker.net/forums/topic/308603-fonts-for-yu-gi-oh-card-making-with-multilingual-support/'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'name',
|
||||
prompt: 'What do you want the card to be named?',
|
||||
type: 'string',
|
||||
max: 50
|
||||
},
|
||||
{
|
||||
key: 'effect',
|
||||
prompt: 'What should the card\'s effect be?',
|
||||
type: 'string'
|
||||
},
|
||||
{
|
||||
key: 'type',
|
||||
prompt: 'What type should the card be?',
|
||||
type: 'string',
|
||||
max: 25
|
||||
},
|
||||
{
|
||||
key: 'level',
|
||||
prompt: 'What level should the card be?',
|
||||
type: 'integer',
|
||||
min: 1,
|
||||
max: 12
|
||||
},
|
||||
{
|
||||
key: 'image',
|
||||
prompt: 'What image would you like to edit?',
|
||||
type: 'image',
|
||||
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 256 })
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { name, effect, type, level, image }) {
|
||||
const id = Math.floor(Math.random() * 100000000);
|
||||
const setID = Math.floor(Math.random() * 1000);
|
||||
try {
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'yu-gi-oh-gen', 'base.png'));
|
||||
const atr = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'yu-gi-oh-gen', 'atr.png'));
|
||||
const levelI = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'yu-gi-oh-gen', 'level.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.fillStyle = 'white';
|
||||
ctx.fillRect(0, 0, base.width, base.height);
|
||||
ctx.drawImage(data, 109, 241, 590, 590);
|
||||
ctx.drawImage(base, 0, 0);
|
||||
ctx.drawImage(atr, 669, 61, 77, 77);
|
||||
for (let i = 0; i < level; i++) {
|
||||
const x = 676 - (676 * i) - (5 * i);
|
||||
ctx.drawImage(levelI, x, 160);
|
||||
}
|
||||
ctx.font = '14px Noto';
|
||||
ctx.fillStyle = 'black';
|
||||
ctx.textBaseline = 'top';
|
||||
ctx.font = '87px Matrix';
|
||||
ctx.fillText(name, 74, 79, 585);
|
||||
ctx.font = '27px Matrix Book';
|
||||
const wrappedEffect = await wrapText(ctx, effect, 660);
|
||||
ctx.fillText(wrappedEffect.join('\n'), 76, 929);
|
||||
ctx.font = 'normal smallcaps 31px Stone Serif';
|
||||
ctx.fillText(`[ ${type} / Effect ]`, 77, 896);
|
||||
ctx.font = 'normal semibold 22px Stone Serif';
|
||||
ctx.fillText(id.toString().padStart(8, '0'), 37, 1134);
|
||||
ctx.fillText(`XIAO-${setID.toString().padStart(3, '0')}`, 572, 856);
|
||||
ctx.font = 'normal semibold 21px Stone Serif';
|
||||
ctx.fillText('⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺', 81, 1060);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'yu-gi-oh-gen.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": "116.19.0",
|
||||
"version": "116.20.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user