|
|
@ -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 { |
|
|
|