I'm almost done with my bot but I have a few questions
Which one would be the best and optimized way
A:
1. Store bot's inventory in a variable for the first time loading the bot
2. Every time a user request for cards sets stock, access stored inventory to minimize request to steam
3. This will also be true in creating trade-offers and adding bot's items
3. Only update variable with the latest inventory contents it after successfully done a trade
B:
1. For every request that needs to access bot's inventory, always fetch latest bot's data via getInventoryContents()
2. Will not do an update to the variable.
My first choice is A but my concern is,
this is a steam card bot(level up) with lot's of cards in inventory(up to 50000 at minimum)
when someone orders enough sets that it will take a few minutes for sentOfferChanged() to emit and between that time another user orders, since bot's inventory was cached, it will still use that inventory contents since sentOfferChanged() has not fired yet. What will happen to that trade assuming it was successfully sent by the bot?
Is using the option B more reliable? or even if using option B, fetching bot's inventory contents while an offer was sent and being accepted by the user, will receive a not updated inventory contents?
I encountered some card bots when i try to buy for 400+ sets(not less than 20000 cards, 5 is the least number of cards per set), eventhough I already accepted the trade, after waiting more than a 20 minutes, the trade has not gone thru and it becomes "trade offer cancelled" and sometimes "items unavailable".