commit 8bbc22c06c5a8f2df9fb30e95d90eb6f14d983d5
parent 77a37a0ed3577385ae93977b40b6198ec0a65cde
Author: night0721 <[email protected]>
Date: Sat, 8 Jan 2022 08:06:52 +0800
Version v3.5.0
Diffstat:
1 file changed, 35 insertions(+), 0 deletions(-)
diff --git a/unused/commands/Utilities/shorturl.js b/unused/commands/Utilities/shorturl.js
@@ -0,0 +1,35 @@
+const URLClient = require("../../../client/URLClient");
+module.exports = {
+ name: "shorten-url",
+ description: "Shorten a URL",
+ options: [
+ {
+ type: 3,
+ name: "short-name",
+ description:
+ "The short name that for the shorten-url (For example, https://url.cath.gq/youtube)",
+ required: true,
+ },
+ {
+ type: 3,
+ name: "link",
+ description:
+ "The link for the shorten-url (For example, https://youtube.com)",
+ required: true,
+ },
+ ],
+ run: async (client, interaction, args) => {
+ if (!args[1].includes("https://")) {
+ interaction.followUp({ content: "The link must contain 'https://'" });
+ } else {
+ const shortName = args[0];
+ const targetURL = args[1];
+ const cc = await URLClient.createShortURL(shortName, targetURL);
+ if (!cc) {
+ interaction.followUp({ content: `URL already exist` });
+ } else {
+ interaction.followUp({ content: `https://url.cath.gq/${cc}` });
+ }
+ }
+ },
+};