woah that was easier than i expected

This commit is contained in:
rhearmas 2019-12-20 20:51:52 -05:00
parent dffe4f5aee
commit 3f3dc42332

43
commands/Utility/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>"
};