From a9ef7e0e4d6691c5efafe1b691ab6f64a200f7c2 Mon Sep 17 00:00:00 2001 From: gsd Date: Tue, 14 Nov 2023 14:10:28 +0300 Subject: [PATCH] nyk --- tradebot.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tradebot.js b/tradebot.js index 5d57b38..5aaff92 100644 --- a/tradebot.js +++ b/tradebot.js @@ -113,7 +113,11 @@ function setupClient() { if (calculate(offer)) { console.log(consoleTime(), `[${offer.id}] Try accept trade`); offer.accept(false, function(error, status) { - if (error.message === "Not Logged In") { + if (error == null) { + console.log(consoleTime(), "Success accept trade"); + return; + } + if ("message" in error && error.message === "Not Logged In") { console.log(consoleTime(), "Need relog to accept"); client.relog(); } else { @@ -123,7 +127,11 @@ function setupClient() { } else { console.log(consoleTime(), `[${offer.id}] Try decline trade`); offer.decline(function(error, status) { - if (error.message === "Not Logged In") { + if (error == null) { + console.log(consoleTime(), "Success decline trade"); + return; + } + if ("message" in error && error.message === "Not Logged In") { console.log(consoleTime(), "Need relog to decline"); client.relog(); } else {