From 4af141772a8fd5769c8229953a6bb053d51684eb Mon Sep 17 00:00:00 2001 From: "Jonny_Bro (Nikita)" Date: Mon, 6 Nov 2023 18:38:38 +0500 Subject: [PATCH] fix checkjar getting wrong jar --- commands/IAT/checkjar.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/commands/IAT/checkjar.js b/commands/IAT/checkjar.js index 344d7b17..50593a62 100644 --- a/commands/IAT/checkjar.js +++ b/commands/IAT/checkjar.js @@ -42,15 +42,15 @@ class Checkjar extends BaseCommand { const clientInfo = await fetch("https://api.monobank.ua/personal/client-info", { method: "GET", headers: { - "X-Token": client.config.apiKeys.monobankApiKey, + "X-Token": client.config.apiKeys.monobank.key, "Content-Type": "application/json", }, }).then(res => res.json()); - const jar = clientInfo.jars[1]; + const jar = clientInfo.jars.find(j => j.id === client.config.apiKeys.monobank.jar); const jarTransactions = await fetch(`https://api.monobank.ua/personal/statement/${jar.id}/${Date.now() - 7 * 24 * 60 * 60 * 1000}/${Date.now()}`, { method: "GET", headers: { - "X-Token": client.config.apiKeys.monobankApiKey, + "X-Token": client.config.apiKeys.monobank.key, "Content-Type": "application/json", }, }).then(res => res.json());