mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-12-18 17:39:33 +05:00
fix shorturl
This commit is contained in:
parent
15bb5bf014
commit
5a30a64230
4 changed files with 8 additions and 5 deletions
|
@ -51,7 +51,9 @@ class Shorturl extends BaseCommand {
|
||||||
await interaction.deferReply({ ephemeral: interaction.options.getBoolean("ephemeral") || false });
|
await interaction.deferReply({ ephemeral: interaction.options.getBoolean("ephemeral") || false });
|
||||||
|
|
||||||
const url = interaction.options.getString("url");
|
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",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Authorization": `Bearer ${client.config.apiKeys.sink}`,
|
"Authorization": `Bearer ${client.config.apiKeys.sink}`,
|
||||||
|
@ -61,7 +63,7 @@ class Shorturl extends BaseCommand {
|
||||||
}).then(res => res.json());
|
}).then(res => res.json());
|
||||||
|
|
||||||
interaction.editReply({
|
interaction.editReply({
|
||||||
content: `<https://s.jonnybro.ru/${res.slug}>`,
|
content: `<https://s.jonnybro.ru/${res.link.slug}>`,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
"DESCRIPTION": "Shortens a URL",
|
"DESCRIPTION": "Shortens a URL",
|
||||||
"USAGE": "[url]",
|
"USAGE": "[url]",
|
||||||
"EXAMPLES": "shorturl url:https://google.com"
|
"EXAMPLES": "shorturl url:https://google.com",
|
||||||
|
"NOT_A_LINK": "Provide a proper URL!"
|
||||||
}
|
}
|
|
@ -2,5 +2,5 @@
|
||||||
"DESCRIPTION": "Укоротить ссылку",
|
"DESCRIPTION": "Укоротить ссылку",
|
||||||
"USAGE": "[url]",
|
"USAGE": "[url]",
|
||||||
"EXAMPLES": "shorturl url:https://google.com",
|
"EXAMPLES": "shorturl url:https://google.com",
|
||||||
"URL": "Ссылка"
|
"NOT_A_LINK": "Укажите правильный URL!"
|
||||||
}
|
}
|
|
@ -2,5 +2,5 @@
|
||||||
"DESCRIPTION": "Укоротити посилання",
|
"DESCRIPTION": "Укоротити посилання",
|
||||||
"USAGE": "[url]",
|
"USAGE": "[url]",
|
||||||
"EXAMPLES": "shorturl url:https://google.com",
|
"EXAMPLES": "shorturl url:https://google.com",
|
||||||
"URL": "Посилання"
|
"NOT_A_LINK": "Вкажіть правильну URL!"
|
||||||
}
|
}
|
Loading…
Reference in a new issue