From 6aee118627c60eaea282d2c5c8f833e3ddaa1d5a Mon Sep 17 00:00:00 2001 From: idinium96 <47635037+idinium96@users.noreply.github.com> Date: Tue, 5 Nov 2024 02:27:35 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20fix=20some=20inconsistency?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/classes/Commands/sub-classes/Manager.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/classes/Commands/sub-classes/Manager.ts b/src/classes/Commands/sub-classes/Manager.ts index 4ba80cac3..6e901741b 100644 --- a/src/classes/Commands/sub-classes/Manager.ts +++ b/src/classes/Commands/sub-classes/Manager.ts @@ -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 @@ -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); @@ -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); @@ -718,7 +725,7 @@ export default class ManagerCommands { log.debug( 'Checking listings for ' + pluralize('item', pricelistCount, true) + - ` [${skusToCheck.join(', ')}] ...` + ` [${priceKeysToCheck.join(', ')}] ...` ); this.bot.sendMessage( @@ -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,