mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 05:04:58 +05:00
update checkjar
This commit is contained in:
parent
3aca11ebb3
commit
030f725777
1 changed files with 3 additions and 9 deletions
|
@ -39,15 +39,14 @@ class Checkjar extends BaseCommand {
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
||||||
const jarsList = await fetch("https://api.monobank.ua/personal/client-info", {
|
const clientInfo = await fetch("https://api.monobank.ua/personal/client-info", {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
"X-Token": client.config.apiKeys.monobankApiKey,
|
"X-Token": client.config.apiKeys.monobankApiKey,
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
},
|
},
|
||||||
}).then(res => res.json());
|
}).then(res => res.json());
|
||||||
const jar = jarsList.jars[1];
|
const jar = clientInfo.jars[1];
|
||||||
|
|
||||||
const jarTransactions = await fetch(`https://api.monobank.ua/personal/statement/${jar.id}/${Date.now() - (7 * 24 * 60 * 60 * 1000)}/${Date.now()}`, {
|
const jarTransactions = await fetch(`https://api.monobank.ua/personal/statement/${jar.id}/${Date.now() - (7 * 24 * 60 * 60 * 1000)}/${Date.now()}`, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -61,11 +60,7 @@ class Checkjar extends BaseCommand {
|
||||||
.setFooter({
|
.setFooter({
|
||||||
text: client.config.embed.footer,
|
text: client.config.embed.footer,
|
||||||
})
|
})
|
||||||
.setAuthor({
|
.setDescription(`Текущий баланс: **${jar.balance / Math.pow(10, 2)}** грн\nТребуется на след. месяц: **379,18** грн (по курсу евро на 02.07.2023).\nЗдесь указаны последние 10 транзакций.`);
|
||||||
name: "Monobank API",
|
|
||||||
iconURL: "https://api.monobank.ua/docs/logo.png",
|
|
||||||
})
|
|
||||||
.setDescription(`Текущий баланс: **${jar.balance / Math.pow(10, 2)}** грн\nТребуется на след. месяц: ~**381** грн (по курсу евро на 15.06.2023)`);
|
|
||||||
|
|
||||||
jarTransactions.length = 10;
|
jarTransactions.length = 10;
|
||||||
|
|
||||||
|
@ -76,7 +71,6 @@ class Checkjar extends BaseCommand {
|
||||||
{
|
{
|
||||||
name: `${t.description}`,
|
name: `${t.description}`,
|
||||||
value: `Дата: ${time.locale("uk-UA").format("DD MMMM YYYY, HH:mm")}\nСумма: ${t.amount / Math.pow(10, 2)} грн`,
|
value: `Дата: ${time.locale("uk-UA").format("DD MMMM YYYY, HH:mm")}\nСумма: ${t.amount / Math.pow(10, 2)} грн`,
|
||||||
inline: true,
|
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue