R3v3rso Posted November 21, 2018 Report Share Posted November 21, 2018 Hello,I'm currently stuck with something that I assume is very simple, but I can't find any tutorial or help about it anywhere on the internet... I'm currently trying to create a bot that trades random Steam game codes for random steam cards, but my problem right now is that I don't know how to check if all items that the bot will receive are trading cards. I'm aware that this probably is a really easy thing, but I really have no idea where to find my answers :/ Thanks a lot for reading this, hopefully you can me with that This is what I have done so far : //This is where the pain begins. function processOffer(offer) { if (offer.partner.getSteamID64() === config.ownerID) { acceptOffer(offer); } else if (offer.isGlitched() || offer.state === 11) { console.log("Offer was glitched, declining."); declineOffer(offer); } else { var theirItems = offer.itemsToReceive var ourItems = offer.itemsToGive }} manager.on('newOffer', (offer) => { console.log("Offer received, processing"); processOffer(offer); })} Quote Link to comment Share on other sites More sharing options...
Dr. McKay Posted November 25, 2018 Report Share Posted November 25, 2018 Do something like this: let isEachItemATradingCard = theirItems.every((item) => { if (item.appid != 753 || item.contextid != 6) { // AppID is not "Steam" or contextid is not "Community" return false; } let tag = item.getTag('item_class'); if (!tag || tag.internal_name != 'item_class_2') { // Not a trading card // You could also check that tag.localized_tag_name == 'Trading Card' but that would only work for English return false; } return true; // all checks passed }); R3v3rso 1 Quote Link to comment Share on other sites More sharing options...
R3v3rso Posted November 25, 2018 Author Report Share Posted November 25, 2018 Thank you very much ! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.