Skip to content

Commit

Permalink
🔨 fix some inconsistency
Browse files Browse the repository at this point in the history
  • Loading branch information
idinium96 committed Nov 4, 2024
1 parent d0be169 commit 6aee118
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/classes/Commands/sub-classes/Manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import log from '../../../lib/logger';
import { pure, testPriceKey } from '../../../lib/tools/export';
import filterAxiosError from '@tf2autobot/filter-axios-error';
import { AxiosError } from 'axios';
import { Entry } from '../../Pricelist';

// Bot manager commands

Expand Down Expand Up @@ -619,7 +620,13 @@ export default class ManagerCommands {
}
}

const match = this.bot.pricelist.getPrice({ priceKey: listingSKU });
let match: Entry | null;
const assetIdPrice = this.bot.pricelist.getPrice({ priceKey: listing.id.slice('440_'.length) });
if (null !== assetIdPrice) {
match = assetIdPrice;
} else {
match = this.bot.pricelist.getPrice({ priceKey: listingSKU });
}

if (isFilterCantAfford && listing.intent === 0 && match !== null) {
const canAffordToBuy = inventoryManager.isCanAffordToBuy(match.buy, inventory);
Expand Down Expand Up @@ -708,8 +715,8 @@ export default class ManagerCommands {
}
}

const skusToCheck = Object.keys(pricelist);
const pricelistCount = skusToCheck.length;
const priceKeysToCheck = Object.keys(pricelist);
const pricelistCount = priceKeysToCheck.length;

if (pricelistCount > 0) {
clearTimeout(this.executeRefreshListTimeout);
Expand All @@ -718,7 +725,7 @@ export default class ManagerCommands {
log.debug(
'Checking listings for ' +
pluralize('item', pricelistCount, true) +
` [${skusToCheck.join(', ')}] ...`
` [${priceKeysToCheck.join(', ')}] ...`
);

this.bot.sendMessage(
Expand All @@ -738,7 +745,7 @@ export default class ManagerCommands {
}, (this.pricelistCount > 4000 ? 60 : 30) * 60 * 1000);

await this.bot.listings.recursiveCheckPricelist(
skusToCheck,
priceKeysToCheck,
pricelist,
true,
this.pricelistCount > 4000 ? 400 : 200,
Expand Down

0 comments on commit 6aee118

Please sign in to comment.