mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-25 06:42:51 +02:00
More Stoof
This commit is contained in:
@@ -38,18 +38,21 @@ module.exports = class SteamCardCommand extends Command {
|
||||
size: 512
|
||||
});
|
||||
try {
|
||||
const canvas = createCanvas(494, 568);
|
||||
const ctx = canvas.getContext('2d');
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'steam-card.png'));
|
||||
const { body } = await snekfetch.get(avatarURL);
|
||||
const avatar = await loadImage(body);
|
||||
const canvas = createCanvas(base.width, base.height);
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.fillStyle = 'white';
|
||||
ctx.fillRect(0, 0, 494, 568);
|
||||
ctx.fillRect(0, 0, base.width, base.height);
|
||||
ctx.drawImage(avatar, 25, 25, 450, 450);
|
||||
ctx.drawImage(base, 0, 0);
|
||||
ctx.font = '30px Noto';
|
||||
ctx.fillText(member.displayName, 35, 48);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'steam-card.png' }] });
|
||||
return msg.say({ files: [{
|
||||
attachment: canvas.toBuffer(),
|
||||
name: 'steam-card.png'
|
||||
}] });
|
||||
} catch (err) {
|
||||
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user