mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-12-29 23:03:02 +05:00
Compare commits
2 commits
d3bc25dcb1
...
5a30a64230
Author | SHA1 | Date | |
---|---|---|---|
5a30a64230 | |||
15bb5bf014 |
4 changed files with 9 additions and 8 deletions
|
@ -51,19 +51,19 @@ class Shorturl extends BaseCommand {
|
|||
await interaction.deferReply({ ephemeral: interaction.options.getBoolean("ephemeral") || false });
|
||||
|
||||
const url = interaction.options.getString("url");
|
||||
const res = await fetch("https://i.jonnybro.ru/api/shorten", {
|
||||
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}`,
|
||||
"Content-Type": "application/json",
|
||||
Authorization: client.config.apiKeys.zipline,
|
||||
},
|
||||
body: JSON.stringify({ url: url }),
|
||||
}).then(res => res.json());
|
||||
|
||||
console.log(res);
|
||||
|
||||
interaction.editReply({
|
||||
content: `<${res.url}>`,
|
||||
content: `<https://s.jonnybro.ru/${res.link.slug}>`,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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!"
|
||||
}
|
|
@ -2,5 +2,5 @@
|
|||
"DESCRIPTION": "Укоротить ссылку",
|
||||
"USAGE": "[url]",
|
||||
"EXAMPLES": "shorturl url:https://google.com",
|
||||
"URL": "Ссылка"
|
||||
"NOT_A_LINK": "Укажите правильный URL!"
|
||||
}
|
|
@ -2,5 +2,5 @@
|
|||
"DESCRIPTION": "Укоротити посилання",
|
||||
"USAGE": "[url]",
|
||||
"EXAMPLES": "shorturl url:https://google.com",
|
||||
"URL": "Посилання"
|
||||
"NOT_A_LINK": "Вкажіть правильну URL!"
|
||||
}
|
Loading…
Reference in a new issue