mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-18 21:40:49 +02:00
New Challenger Image
This commit is contained in:
@@ -37,7 +37,7 @@ module.exports = class CardCommand extends Command {
|
||||
size: 256
|
||||
});
|
||||
try {
|
||||
const cardID = Math.floor(Math.random() * (9999 - 1000 + 1)) + 1000;
|
||||
const cardID = Math.floor(Math.random() * ((9999 - 1000) + 1)) + 1000;
|
||||
let rarity;
|
||||
if (cardID < 5000) rarity = 'C';
|
||||
else if (cardID < 8000) rarity = 'U';
|
||||
|
||||
@@ -33,15 +33,13 @@ module.exports = class ChallengerCommand extends Command {
|
||||
size: 256
|
||||
});
|
||||
try {
|
||||
const canvas = createCanvas(500, 500);
|
||||
const canvas = createCanvas(800, 450);
|
||||
const ctx = canvas.getContext('2d');
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'challenger.png'));
|
||||
const { body } = await snekfetch.get(avatarURL);
|
||||
const avatar = await loadImage(body);
|
||||
ctx.fillStyle = '#ff0028';
|
||||
ctx.fillRect(0, 0, 500, 500);
|
||||
ctx.drawImage(avatar, 226, 155, 200, 200);
|
||||
ctx.drawImage(base, 0, 0);
|
||||
ctx.drawImage(avatar, 484, 98, 256, 256);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'challenger.png' }] });
|
||||
} catch (err) {
|
||||
return msg.say(`Oh no, the image generation failed: \`${err.message}\`. Try again later!`);
|
||||
|
||||
Reference in New Issue
Block a user