2021-04-05 04:35:12 +00:00
|
|
|
import {Command, NamedCommand} from "../../core";
|
2020-12-15 01:44:28 +00:00
|
|
|
import * as https from "https";
|
|
|
|
|
2021-04-05 04:35:12 +00:00
|
|
|
export default new NamedCommand({
|
2020-12-15 01:44:28 +00:00
|
|
|
description: "Shortens a given URL.",
|
|
|
|
run: "Please provide a URL.",
|
|
|
|
any: new Command({
|
2021-04-10 13:34:55 +00:00
|
|
|
async run({send, message, channel, guild, author, member, client, args}) {
|
2021-04-05 04:35:12 +00:00
|
|
|
https.get("https://is.gd/create.php?format=simple&url=" + encodeURIComponent(args[0]), function (res) {
|
2020-12-15 07:56:09 +00:00
|
|
|
var body = "";
|
|
|
|
res.on("data", function (chunk) {
|
|
|
|
body += chunk;
|
|
|
|
});
|
|
|
|
res.on("end", function () {
|
2021-04-10 13:34:55 +00:00
|
|
|
send(`<${body}>`);
|
2020-12-15 07:56:09 +00:00
|
|
|
});
|
|
|
|
});
|
2020-12-15 01:44:28 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
});
|