Jump to content
McKay Development

PonyExpress

Member
  • Posts

    61
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

5505 profile views
  1. Yes. But I wanted to know what should I do If my next request will use Old endpoint :) (After use new endpoint) In my case I am using the new endpoint until error 429 happens, after that I use the old endpoint.
  2. Please advise if I use both methods to get inventory (old and new endpoints). Am I getting startId/startPos correctly? (to continue getting inventory in another way if need) pos = 1 function getItems(inventory, currency, startId, startPos) { // startId - assetid for new endpoint // startPos - pos for old endpoint // ... getting items using the old or new endpoint ... // if used new endpoint: if (body.more_items) { getItems(inventory, currency, body.last_assetid, startPos + body.assets.length) // or startPos should be +/- 1? return } // if used old endpoint: if (body.more) { pos = pos + Object.keys(body.rgInventory).length + Object.keys(body.rgCurrency).length let lastAssetid = Object.keys(body.rgInventory)[Object.keys(body.rgInventory).length - 1] || Object.keys(body.rgCurrency)[Object.keys(body.rgCurrency).length - 1] // this is the last received Assetid? getItems(inventory, currency, lastAssetid, body.more_start) return } }
  3. I had this problem. Data from pages like https://steamcommunity.com/profiles/76561198054394425/?xml=1 are cached both in a regular browser and in nodeJS. And as a result, the function getSteamUser can return old data. I don't know how to disable caching in nodeJS. I used quite simply another solution. \node_modules\steamcommunity\classes\CSteamUser.js Tests: community.getSteamUser(new SteamID("76561198125730690"), (error, user) => { if (error) { console.log(error) } else { console.log(user.privacyState) } }) Results, without fix: public // Here I make the profile private public With fix: private // Here I make the profile public public // Here I make the profile for friends only friendsonly
  4. "id parameter should be a user URL string or a SteamID object" "id - Either a SteamID object or a user's URL (the part after /id/)" https://github.com/DoctorMcKay/node-steamcommunity/wiki/SteamCommunity#getsteamuserid-callback When trying to use: community.getSteamUser("76561198274802037", (error, user) => { if (error) { console.log(error) } else { console.log(user) } }) I get an error: "The specified profile could not be found." Everything is good when using: new SteamID("76561198274802037") My mistake, sorry, everything is fine. I was sure it was about SteamID64 but here you need a custom url part.
  5. In my case it works like this. Maybe this will help you. // lodash // cards = { "<appid>": ["<classid>": [ {<item>}, ... ], ... ], ... } // cardData = {"220":{"amount":8,"name":"Half-Life 2"} ... } function getSets(cards, callback) { let cardSets = {} let extraCards = [] let unknownCards = [] lodash.forOwn(cards, (cards, id) => { id = id.toString() if (cardData[id]) { let cardCount = lodash.mapValues(cards, array => array.length) cardCount = Object.keys(cardCount).map(number => cardCount[number]) let min = Math.min(...cardCount) let max = Math.max(...cardCount) // There is at least one full set. if (Object.keys(cards).length == cardData[id].amount) { cardSets[id] = [] for (let i = 0; i < min; i++) { let set = [] lodash.forOwn(cards, item => { set.push(item[i]) }) cardSets[id].push(set) } // There are no full sets. } else { min = 0 } // Extra cards: for (let i = min; i < max; i++) { lodash.forOwn(cards, item => { if (item[i]) { extraCards.push(item[i]) } }) } // Unknown cards: } else { lodash.forOwn(cards, item => { unknownCards.push(item) }) } }) callback(cardSets, extraCards, unknownCards) }
  6. If I remember correctly, you can specify language in Options ( https://github.com/DoctorMcKay/node-steam-tradeoffer-manager/wiki/TradeOfferManager#language ) In this case, you will receive all data like name and tags. This can take up a lot of memory. (in my case, this required several gigabytes with a large number of trading offers / items in offers) If language disabled, you can check only classid. I don't know of any database that gives any additional information by classid.
  7. Error: EYldRefreshAppIfNecessary failed with EResult 20 After the trade is completed, I get my Steam inventory using: trade_offer_manager.getUserInventoryContents(my_sid, 753, 6, { tradableOnly: tradableOnly }, (error, inventory) => { //... My inventory is large, ~150k items Earlier (winter-spring), I had a delay of 1 second before getting my inventory and there were no errors. Right now I have a 10 second delay and I still get this error sometimes. If I use less than 8 seconds - the error is always. Is there anything I can do or is this a bug on the steam servers and I can't do anything? Thanks.
  8. Hello. 1. If the bot receives a trade offer from user. then the bot makes a counteroffer. 2. If the user makes counteroffer, the bot should decline it. So, The bot must decline offers that are counteroffers. How can I implement this? I did not find any data in TradeOffer object that could help me with this. Are there any ideas how I should do this? Maybe the bot should compare time? Llike if newOffer created time = offer with status "Countered" updated time then decline? Exam;e: let trade = new SteamTradeofferManager() let a trade.on("newOffer", (offer) => { if (offer.created == a) { // decline } else { // create counteroffer } }) trade.on("sentOfferChanged", (offer) => { if (offer.state == 4) { a = offer.updated } })
  9. In this code, we just get the last 2 digits of the level, divide it by 10, and round to a smaller one. (example: level 789 = 89 / 10 = 8.9 = 8 = cherry) It does not require special api / packages.
  10. // 0 10 20 30 40 50 60 70 80 90 let colors = ["Gray", "Red", "Orange", "Yellow", "Green", "Blue", "Lilac", "Pink", "Cherry", "Brown"]; client.on("friendMessage", (SENDER, MSG) => { client.getSteamLevels([SENDER], (ERR, CURRENTLEVEL) => { if (!ERR) { console.log("The color of your level is " + colors[Math.floor(CURRENTLEVEL[SENDER] % 100 / 10)]); } }); });
  11. Thank you for the information, but I would like to draw attention to this again: 2. In addition, I conducted this experiment several times: let notFriendSID = "76561198042084472"; manager.getUserInventoryContents(notFriendSID, 730, 2, false, (ERR) => { if (ERR) { console.log("getUserInventoryContents ERROR: " + ERR); } else { console.log("getUserInventoryContents OK!"); } }); setTimeout(function () { manager.loadUserInventory(notFriendSID, 730, 2, false, (ERR, INV) => { if (ERR) { console.log("loadUserInventory ERROR: " + ERR); } else { console.log("loadUserInventory OK!"); console.log(INV); } }); }, $SECOND * 3); return; In many cases, I get: Error for getUserInventoryContents and OK for loadUserInventory (after 3 sec). Is this just a coincidence or loadUserInventory is working better?
  12. In about 50% of the cases when I try to get a CSGO inventory, I get EYldRefreshAppIfNecessary failed with EResult 55. manager.getUserInventoryContents(SID, 730, 2, false, (ERR, USERINVENTORY) => { If I try to open my friends CSGO inventory using Steam, I will also get an error "This inventory is currently unavailable. Please try again later." in about 50% of cases. But, if I offer a trade - the inventory will be available. Why does this happen and can I use another method to get inventory? Left image (profile - inventory), Right image - trade offer. Actually this problem is not permanent. Right now I am not getting this error. But in the screenshot - I first opened the inventory (=error), after that I sent the trade offer (=all good). Reload inventory (=error), Reload trade offer (=all good). I am sure of this and have checked it several times.
  13. I'll just leave it in case someone needs. // For test: let CONFIG, SENDER = "76561197983852931", amountOfKeys = 10; CONFIG.ACCEPTEDKEYSCS = ["CS20 Case Key", "Prisma Case Key", "Danger Zone Case Key", "Horizon Case Key", "Clutch Case Key", "Spectrum 2 Case Key", "Spectrum Case Key", "Gamma 2 Case Key", "Gamma Case Key", "Glove Case Key", "Chroma 3 Case Key", "Operation Wildfire Case Key", "Falchion Case Key", "Chroma 2 Case Key", "Chroma Case Key", "Operation Vanguard Case Key", "Operation Breakout Case Key", "Huntsman Case Key", "Operation Phoenix Case Key", "Shadow Case Key", "Revolver Case Key", "Winter Offensive Case Key", "eSports Key", "CS:GO Case Key"]; // Getting Inventory: manager.getUserInventoryContents(SENDER, 730, 2, false, (ERR, USERINVENTORY) => { // (!!!) false if (ERR) { console.log(ERR); } else { let hisKeys = [], notMarketable = 0, notTradable = 0; for (let i = 0; i < USERINVENTORY.length; i++) { if (hisKeys.length == amountOfKeys) { break; } else if (CONFIG.ACCEPTEDKEYSCS.includes(USERINVENTORY[i].market_hash_name)) { // This key is accepted if (USERINVENTORY[i].tradable && USERINVENTORY[i].marketable) { hisKeys.push(USERINVENTORY[i]); } else if (!USERINVENTORY[i].marketable) { // This key is not marketable, never notMarketable++; } else if (!USERINVENTORY[i].tradable) { // This key is not tradable, delay up to 7 days notTradable++; } } } // Cancel if the user does not have keys or their quantity is not enough: if (hisKeys.length < amountOfKeys) { let addInfo = ""; if (notTradable) { addInfo += "\n\nSome of your keys (" + notTradable + ") have an exchange delay of up to 7 days."; } if (notMarketable) { addInfo += "\n\nSome of your keys (" + notMarketable + ") bought in the game and can not be exchanged or sold, never!" + "\nYou can return them back within 48 hours after purchase." + "\nhttps://help.steampowered.com/en/wizard/HelpWithGameIssue/?appid=730&issueid=107"; } if (hisKeys.length < 1) { // No one client.chatMessage(SENDER, "You do not have the keys that I accept." + addInfo); } else { // Less than need client.chatMessage(SENDER, "You do not have enough keys." + addInfo); } } else { console.log(hisKeys.length + "/" + amountOfKeys); // trade.addTheirItems(hisKeys); // Adding keys to the trade (!!!) } } });
  14. Hey. I wanted to know if there is a way to find out if the User's inventory has been changed? Without a second inventory check. Maybe there is a way to get an inventory hash or item count? Suppose the following situation: User uses command !CHECK The bot receives the user's inventory and gives information. User uses command !SELL The bot receives the user's inventory and and sends the trade offer. I would like to get rid of the second inventory check and use the first (I save it). But there may be another situation: User uses command !CHECK The bot receives the user's inventory and gives information. User receives or sells items / Inventory has been changed User uses command !SELL ? Any ideas? I think I can save the result with a time stamp. But I think that even here rare errors are possible. // !check: community.getUserInventoryContents( ... (err, inv) => { hisInv = [inv, Date.now()]; // !sell: if (hisInv and hisInv[1] < Date.now() - $minute) { //sendtradeoffer } else { community.getUserInventoryContents( ... (err, inv) => { //sendtradeoffer
  15. Thank you for your quick response. Is there any information about all the properties? I would like to know more about the differences between market_hash_name and market_hash and some others.
×
×
  • Create New...