mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-20 21:44:48 +02:00
Add Attack/Defense
This commit is contained in:
@@ -75,6 +75,20 @@ module.exports = class YuGiOhGenCommand extends Command {
|
|||||||
min: 1,
|
min: 1,
|
||||||
max: 12
|
max: 12
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: 'attack',
|
||||||
|
prompt: 'How much attack should the card have?',
|
||||||
|
type: 'integer',
|
||||||
|
min: 0,
|
||||||
|
max: 9999
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'defense',
|
||||||
|
prompt: 'How much defense should the card have?',
|
||||||
|
type: 'integer',
|
||||||
|
min: 0,
|
||||||
|
max: 9999
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: 'image',
|
key: 'image',
|
||||||
prompt: 'What image would you like to edit?',
|
prompt: 'What image would you like to edit?',
|
||||||
@@ -85,14 +99,14 @@ module.exports = class YuGiOhGenCommand extends Command {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, { name, effect, type, level, image }) {
|
async run(msg, { name, effect, type, level, attack, defense, image }) {
|
||||||
const id = Math.floor(Math.random() * 100000000);
|
const id = Math.floor(Math.random() * 100000000);
|
||||||
const setID = Math.floor(Math.random() * 1000);
|
const setID = Math.floor(Math.random() * 1000);
|
||||||
try {
|
try {
|
||||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'yu-gi-oh-gen', 'base.png'));
|
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 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 levelI = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'yu-gi-oh-gen', 'level.png'));
|
||||||
const line = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'yu-gi-oh-gen', 'line.png'))
|
const line = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'yu-gi-oh-gen', 'line.png'));
|
||||||
const { body } = await request.get(image);
|
const { body } = await request.get(image);
|
||||||
const data = await loadImage(body);
|
const data = await loadImage(body);
|
||||||
const canvas = createCanvas(base.width, base.height);
|
const canvas = createCanvas(base.width, base.height);
|
||||||
@@ -119,6 +133,9 @@ module.exports = class YuGiOhGenCommand extends Command {
|
|||||||
ctx.font = '22px Stone Serif';
|
ctx.font = '22px Stone Serif';
|
||||||
ctx.fillText(id.toString().padStart(8, '0'), 37, 1128);
|
ctx.fillText(id.toString().padStart(8, '0'), 37, 1128);
|
||||||
ctx.fillText(`XIAO-EN${setID.toString().padStart(3, '0')}`, 572, 850);
|
ctx.fillText(`XIAO-EN${setID.toString().padStart(3, '0')}`, 572, 850);
|
||||||
|
ctx.font = '30px Stone Serif';
|
||||||
|
ctx.fillText(`ATK/${attack}`, 419, 1076);
|
||||||
|
ctx.fillText(`DEF/${defense}`, 578, 1076);
|
||||||
ctx.drawImage(line, 80, 1073);
|
ctx.drawImage(line, 80, 1073);
|
||||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'yu-gi-oh-gen.png' }] });
|
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'yu-gi-oh-gen.png' }] });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user