This commit is contained in:
rhearmas 2019-12-21 11:05:30 -05:00
parent e06e8bcb81
commit e680b166d2

43
commands/Fun/image.js Normal file
View file

@ -0,0 +1,43 @@
const IMAGE_NAME = /\.(jpe?g|png|gif|webp)$/i;
exports.run = async (client, message, args, level) => {
if (!args[0]) {
message.reply("please provide an image URL to send.")
message.delete();
return;
}
message.delete();
const url = args[0];
let name;
if (!IMAGE_NAME.test(url)) {
name = 'image.png';
}
try {
let msg = await message.channel.send({
file: {
name,
attachment: url
}
});
} catch (ignore) {
return msg.edit('Failed to send image.');
}
};
exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: "User"
};
exports.help = {
name: "image",
category: "Utiltiy",
description: "Sends an image from a URL.",
usage: "image <url>"
};