mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 15:07:42 +02:00
31 lines
758 B
JavaScript
31 lines
758 B
JavaScript
const Command = require('../../framework/Command');
|
|
const { loadImage } = require('@napi-rs/canvas');
|
|
const request = require('node-superfetch');
|
|
|
|
module.exports = class ImageSizeCommand extends Command {
|
|
constructor(client) {
|
|
super(client, {
|
|
name: 'image-size',
|
|
aliases: ['img-size', 'size', 'dimensions', 'image-dimensions', 'img-dimensions'],
|
|
group: 'analyze',
|
|
description: 'Determines the size of an image.',
|
|
throttling: {
|
|
usages: 2,
|
|
duration: 10
|
|
},
|
|
args: [
|
|
{
|
|
key: 'image',
|
|
type: 'image-or-avatar'
|
|
}
|
|
]
|
|
});
|
|
}
|
|
|
|
async run(msg, { image }) {
|
|
const { body } = await request.get(image);
|
|
const data = await loadImage(body);
|
|
return msg.reply(`This image is **${data.width}x${data.height}**.`);
|
|
}
|
|
};
|