mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-10 19:04:42 +02:00
More Stoof
This commit is contained in:
@@ -32,13 +32,16 @@ module.exports = class PixelizeCommand extends Command {
|
||||
size: 64
|
||||
});
|
||||
try {
|
||||
const canvas = createCanvas(512, 512);
|
||||
const ctx = canvas.getContext('2d');
|
||||
const { body } = await snekfetch.get(avatarURL);
|
||||
const avatar = await loadImage(body);
|
||||
const canvas = createCanvas(512, 512);
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.imageSmoothingEnabled = false;
|
||||
ctx.drawImage(avatar, 0, 0, 512, 512);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'pixelize.png' }] });
|
||||
return msg.say({ files: [{
|
||||
attachment: canvas.toBuffer(),
|
||||
name: 'pixelize.png'
|
||||
}] });
|
||||
} catch (err) {
|
||||
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user