diff --git a/commands/General/shorturl.js b/commands/General/shorturl.js index fb889b88..06da073d 100644 --- a/commands/General/shorturl.js +++ b/commands/General/shorturl.js @@ -51,7 +51,9 @@ class Shorturl extends BaseCommand { await interaction.deferReply({ ephemeral: interaction.options.getBoolean("ephemeral") || false }); const url = interaction.options.getString("url"); - const res = fetch("https://s.jonnybro.ru/api/link/create", { + if (!url.startsWith("http")) return interaction.error("general/shorturl:NOT_A_LINK", null, { edit: true }); + + const res = await fetch("https://s.jonnybro.ru/api/link/create", { method: "POST", headers: { "Authorization": `Bearer ${client.config.apiKeys.sink}`, @@ -61,7 +63,7 @@ class Shorturl extends BaseCommand { }).then(res => res.json()); interaction.editReply({ - content: ``, + content: ``, }); } } diff --git a/languages/en-US/general/shorturl.json b/languages/en-US/general/shorturl.json index 542b62d6..121f4655 100644 --- a/languages/en-US/general/shorturl.json +++ b/languages/en-US/general/shorturl.json @@ -1,5 +1,6 @@ { "DESCRIPTION": "Shortens a URL", "USAGE": "[url]", - "EXAMPLES": "shorturl url:https://google.com" + "EXAMPLES": "shorturl url:https://google.com", + "NOT_A_LINK": "Provide a proper URL!" } \ No newline at end of file diff --git a/languages/ru-RU/general/shorturl.json b/languages/ru-RU/general/shorturl.json index 76e304f3..00bda6f0 100644 --- a/languages/ru-RU/general/shorturl.json +++ b/languages/ru-RU/general/shorturl.json @@ -2,5 +2,5 @@ "DESCRIPTION": "Укоротить ссылку", "USAGE": "[url]", "EXAMPLES": "shorturl url:https://google.com", - "URL": "Ссылка" + "NOT_A_LINK": "Укажите правильный URL!" } \ No newline at end of file diff --git a/languages/uk-UA/general/shorturl.json b/languages/uk-UA/general/shorturl.json index 90774a15..20d97df2 100644 --- a/languages/uk-UA/general/shorturl.json +++ b/languages/uk-UA/general/shorturl.json @@ -2,5 +2,5 @@ "DESCRIPTION": "Укоротити посилання", "USAGE": "[url]", "EXAMPLES": "shorturl url:https://google.com", - "URL": "Посилання" + "NOT_A_LINK": "Вкажіть правильну URL!" } \ No newline at end of file