From 6d6b71b2b4fee4d7c556602756ea1366b5460692 Mon Sep 17 00:00:00 2001 From: rhearmas <34490428+qu-ota@users.noreply.github.com> Date: Sat, 21 Dec 2019 11:34:44 -0500 Subject: [PATCH] vgd shortener --- commands/Fun/shorturl.js | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 commands/Fun/shorturl.js diff --git a/commands/Fun/shorturl.js b/commands/Fun/shorturl.js new file mode 100644 index 0000000..0ec891e --- /dev/null +++ b/commands/Fun/shorturl.js @@ -0,0 +1,41 @@ +const got = require('got'); + +exports.run = async (client, message, args, level) => { + if (args.length < 1) { + await message.reply("please provide a url to shorten!"); + client.user.lastMessage.delete(5000); + message.delete(); + } + + const url = args.join(' '); + + message.delete(); + + const res = await got(`http://v.gd/create.php?format=simple&url=${encodeURIComponent(url)}`); + message.channel.send({ + embed: client.embed('', '', [ + { + name: 'Link', + value: url + }, + { + name: 'Short URL', + value: res.body + } + ]) + }); +}; + +exports.conf = { + enabled: true, + guildOnly: false, + aliases: ['shorten','vgd'], + permLevel: "User" +}; + +exports.help = { + name: "shorturl", + category: "Fun", + description: "Shortens a URL with v.gd.", + usage: "shortenurl " +}; \ No newline at end of file