diff --git a/src/classes/Bot.ts b/src/classes/Bot.ts index 0861428c2..a67f95ef6 100644 --- a/src/classes/Bot.ts +++ b/src/classes/Bot.ts @@ -570,7 +570,6 @@ export default class Bot { } startAutoRefreshListings(): void { - return; // Automatically check for missing listings every 30 minutes let pricelistLength = 0; @@ -634,10 +633,6 @@ export default class Bot { if (this.options.normalize.strangeAsSecondQuality.our && listingSKU.includes(';strange')) { listingSKU = listingSKU.replace(';strange', ''); } - } else { - if (/;[p][0-9]+/.test(listingSKU)) { - listingSKU = listingSKU.replace(/;[p][0-9]+/, ''); - } } let match: Entry | null; @@ -689,8 +684,6 @@ export default class Bot { if ( _listings.length === 1 && listing.intent === 0 && // We only check if the only listing exist is buy order - entry.max > 1 && - amountAvailable > 0 && amountAvailable > entry.min ) { // here we only check if the bot already have that item diff --git a/src/classes/Commands/sub-classes/Manager.ts b/src/classes/Commands/sub-classes/Manager.ts index 1d58e3522..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 @@ -617,13 +618,15 @@ export default class ManagerCommands { if (opt.normalize.strangeAsSecondQuality.our && listingSKU.includes(';strange')) { listingSKU = listingSKU.replace(';strange', ''); } - } else { - if (/;[p][0-9]+/.test(listingSKU)) { - listingSKU = listingSKU.replace(/;[p][0-9]+/, ''); - } } - 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); @@ -668,8 +671,6 @@ export default class ManagerCommands { if ( _listings.length === 1 && listing.intent === 0 && // We only check if the only listing exist is buy order - entry.max > 1 && - amountAvailable > 0 && amountAvailable > entry.min ) { // here we only check if the bot already have that item @@ -714,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); @@ -724,7 +725,7 @@ export default class ManagerCommands { log.debug( 'Checking listings for ' + pluralize('item', pricelistCount, true) + - ` [${skusToCheck.join(', ')}] ...` + ` [${priceKeysToCheck.join(', ')}] ...` ); this.bot.sendMessage( @@ -744,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,