Browse Source

Merge remote-tracking branch 'origin/master'

master
gsd 1 year ago
parent
commit
8d2e14bea6
  1. 2
      trade_checker.js
  2. 12
      tradebot.js

2
trade_checker.js

@ -50,7 +50,7 @@ class TradeChecker {
final_amount += key_count * this.MONTH final_amount += key_count * this.MONTH
if(metal_count >= this.prices_map["week"]) if(metal_count >= this.prices_map["week"])
final_amount += (metal_count / self.prices_map["week"]) * this.WEEK; final_amount += (metal_count / this.prices_map["week"]) * this.WEEK;
else if(metal_count >= this.prices_map["day"]) else if(metal_count >= this.prices_map["day"])
final_amount += (metal_count / this.prices_map["day"]) * this.DAY; final_amount += (metal_count / this.prices_map["day"]) * this.DAY;

12
tradebot.js

@ -113,7 +113,11 @@ function setupClient() {
if (calculate(offer)) { if (calculate(offer)) {
console.log(consoleTime(), `[${offer.id}] Try accept trade`); console.log(consoleTime(), `[${offer.id}] Try accept trade`);
offer.accept(false, function(error, status) { 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"); console.log(consoleTime(), "Need relog to accept");
client.relog(); client.relog();
} else { } else {
@ -123,7 +127,11 @@ function setupClient() {
} else { } else {
console.log(consoleTime(), `[${offer.id}] Try decline trade`); console.log(consoleTime(), `[${offer.id}] Try decline trade`);
offer.decline(function(error, status) { 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"); console.log(consoleTime(), "Need relog to decline");
client.relog(); client.relog();
} else { } else {

Loading…
Cancel
Save