Jump to content
McKay Development

PonyExpress

Member
  • Posts

    61
  • Joined

  • Last visited

Everything posted by PonyExpress

  1. The bot sends 1 item to the user. I always thought error 15 means VAC-ban. However, this may also mean that the user is full of inventory (50/50 if user Free-to-play player). Is there a way to determine the reason why the bot cannot send a trade offer? trade.send((ERR) => { if (ERR && ERR.toString().indexOf("(15)") >= 0) { // VAC or Inv. full
  2. Is there any way to find any hidden chat features?Everyone knows about /code, /pre, etc.But in some cases we can see a special design like "Link removed", "Error sending message". Is it possible that this can be used like for example [error=Error]Any text[/error] Have an idea how to send a link without converting to a block? When the link is at the beginning or end of the message.Will be converted: "https://steamcommunity.com","Text https://steamcommunity.com" or "https://steamcommunity.com Text" Will not be: "Text https://steamcommunity.com Text" If you open a chat with a bot that uses the old script, you will see that the voice call button is not available (with description: User is not in beta testing chat).Is there any way to do this (disable this button) in the latest version node-steam-user without losing any functionality?
  3. I have a function that runs on average about 2 minutes. console.log(currentTime() + " START"); community.getSteamUser... if (DATA.onlineState == "online"... let trade = manager.createOffer... manager.getUserInventoryContents... for (let i in BotSets.BaseSets) {.... } for (let i in BotSets.FoilSets) {.... } // ---------------------------- INV = INV.filter((ITEM) => ITEM.getTag("item_class").internal_name == "item_class_2"); console.log(currentTime() + " TEST, STEP 05-A"); INV = INV.filter((ITEM) => ITEM.market_hash_name.indexOf("470480-Messenger") == -1); for (let i = 0; i < INV.length; i++) { if (i == 5000) console.log(currentTime() + " TEST, ITEMS CHECKED: 5,000"); if (i == 40000) console.log(currentTime() + " TEST, ITEMS CHECKED: 40,000"); if (i == 50000) console.log(currentTime() + " TEST, ITEMS CHECKED: 50,000"); if (i == 60000) console.log(currentTime() + " TEST, ITEMS CHECKED: 60,000"); if (i == 70000) console.log(currentTime() + " TEST, ITEMS CHECKED: 70,000"); if (i == 80000) console.log(currentTime() + " TEST, ITEMS CHECKED: 80,000"); if (i == 90000) console.log(currentTime() + " TEST, ITEMS CHECKED: 90,000"); if (i == 100000) console.log(currentTime() + " TEST, ITEMS CHECKED: 100,000"); if (i == 110000) console.log(currentTime() + " TEST, ITEMS CHECKED: 110,000"); if (amount < CONFIG.LIMITS.MAXTRANSFERCARDS && !idList.includes(INV[i].assetid)) { trade.addMyItem(INV[i]); amount++; } else if (amount == CONFIG.LIMITS.MAXTRANSFERCARDS && !idList.includes(INV[i].assetid)) { reachedLimit = true; break; } } console.log(currentTime() + " TEST, STEP 05-B"); // ---------------------------- trade.send((ERR) => { .... In the end, I get: 23:24 START 23:25 TEST, STEP 05-A 23:25 TEST, ITEMS CHECKED: 5,000 23:25 TEST, ITEMS CHECKED: 40,000 23:26 TEST, ITEMS CHECKED: 50,000 23:26 TEST, ITEMS CHECKED: 60,000 23:26 TEST, ITEMS CHECKED: 70,000 // >> here I see that the bot goes offline 23:26 TEST, ITEMS CHECKED: 80,000 23:26 TEST, ITEMS CHECKED: 90,000 23:27 TEST, STEP 05-B 23:27 Error: HTTP error 401 23:27 client.steamID: null 23:27 (WAIT FOR RECONECT) 23:27 An error occurred while sending trade offer: Error: Not Logged In 23:27 (Login...) Sometimes this function works, about 50/50%, but lately very often the bot goes offline before the trade offer is sent. Are there any tips, how can I prevent the bot from shutting down while this function is running?
  4. I turned off language in tradeoffermanager settings due to memory problems. I think the best option for me will be getting assetid/classid when I receive my inventory, for example when I receive my card sets.
  5. How can I find out what item the user wants to receive? 1. I want to continue if item name = "Abc name Trading Card" 2. If not, decline assetid/classid change very often and the code stops working. manager.on("newOffer", (OFFER) => { console.log(OFFER); if (OFFER.itemsToGive.length == 1 && (OFFER.itemsToGive[0].id == "10964018350" || OFFER.itemsToGive[0].id == "11724177271" )) { // accept TradeOffer { partner: SteamID { universe: 1, type: 1, instance: 1, accountid: 23587203 }, id: '3695907410', message: '', state: 2, itemsToGive: [ EconItem { appid: 753, contextid: '6', assetid: '11497188550', classid: '2238354881', instanceid: '0', amount: 1, missing: false, est_usd: '7', id: '11497188550', fraudwarnings: [], descriptions: [], owner_descriptions: [], actions: [], owner_actions: [], market_actions: [], tags: [], tradable: false, marketable: false, commodity: false, market_tradable_restriction: 0, market_marketable_restriction: 0 } ], itemsToReceive: [], isOurOffer: false, created: 2019-09-04T11:04:43.000Z, updated: 2019-09-04T11:04:43.000Z, expires: 2019-09-18T11:04:43.000Z, tradeID: null, fromRealTimeTrade: false, confirmationMethod: 0, escrowEnds: null, rawJson: '{\n\t"tradeofferid": "3695907410",\n\t"accountid_other": 23587203,\n\t"message": "",\n\t"expiration_time": 1568804683,\n\t"trade_offer_state": 2,\n\t"items_to_give": [\n\t\t{\n\t\t\t"appid": 753,\n\t\t\t"contextid": "6",\n\t\t\t"assetid": "11497188550",\n\t\t\t"classid": "2238354881",\n\t\t\t"instanceid": "0",\n\t\t\t"amount": "1",\n\t\t\t"missing": false,\n\t\t\t"est_usd": "7"\n\t\t}\n\t],\n\t"is_our_offer": false,\n\t"time_created": 1567595083,\n\t"time_updated": 1567595083,\n\t"from_real_time_trade": false,\n\t"escrow_end_date": 0,\n\t"confirmation_method": 0\n}' } However, I see no way to get the name (without loading all inventory). Is there any way to get the name of the items like getReceivedItems, but for itemsToGive? (And I also wanted to know why tradable = false)
  6. Solved. community.httpRequestGet("https://steamcommunity.com/my/inventory/", (ERR) => { if (ERR) { console.log("ERR"); } else { console.log("OK"); } }); To just reset the count to 0, if I have a large steam inventory, is there any difference to use "https://steamcommunity.com/my/inventory/"or "https://steamcommunity.com/my/inventory/#440"?
  7. Up. I still have not found a solution and am waiting for help.
  8. I do not understand how to reset the value. I want it to be reset after how the value was shown in the console. client.on("newItems", function(count) { if (parseInt(count) > 0) { console.log("New items: " + count); // RESET } });
  9. It depends on which bot you use. Most likely you need to find: .filter((ITEM) => ITEM.getTag("cardborder").internal_name == "cardborder_0"); "cardborder_0" (base cards) and try "cardborder_1" (foil). But you also need to check out many other parts of the code, including getting user profile badges.
  10. There is a limit by Steam: No more than 10 changes in 3 minutes. So the maximum that you can get, animation with 1 frame in 18 seconds.
  11. Dr. McKay, Thank you, at first glance it helped reduce memory consumption to 250-900 Mb. If I open bot trade offers page, I see that the offers are not cleared until i see them.For example, if I open the page 'Sent offers', first time I will see: 1. [Exchange rejected May 3. 2019] 2. [Exchange accepted May 3. 2019] 3. [Exchange accepted May 3. 2019, Delay: 12 days]After uptade this page I will see: 1. [Exchange accepted May 3. 2019, Delay: 12 days] I need to worry about it and somehow clean them or not?
  12. To make it more visual, I deleted almost everything and checked: var SteamTotp = require("steam-totp"); var TradeOfferManager = require("steam-tradeoffer-manager"); var SteamCommunity = require("steamcommunity"); var SteamUser = require("steam-user"); var CONFIG = require("config.js"); var client = new SteamUser(); var community = new SteamCommunity(); var manager = new TradeOfferManager({ "steam": client, "community": community, "language": "en", "pollInterval": "10000", "dataDirectory": CONFIG.POOLDATA.DIR, // "./pool_data" "savePollData": CONFIG.POOLDATA.SAVE // true }); client.logOn({ accountName: CONFIG.USERNAME, password: CONFIG.PASSWORD, twoFactorCode: SteamTotp.getAuthCode(CONFIG.SHAREDSECRET), identity_secret: CONFIG.IDENTITYSECRET, shared_secret: CONFIG.SHAREDSECRET, logonID: 1 }); client.on("loggedOn", () => { console.log("currentTime()" + " [ ACCOUNT ] [ LOGIN ] Name: " + CONFIG.USERNAME + " (" + client.steamID + ")"); client.setPersona(1); }); client.on("webSession", (sessionID, cookies) => { manager.setCookies(cookies, (ERR) => { if (ERR) { console.log("currentTime()" + " [ ACCOUNT ] [ LOGIN ] An error occurred while setting cookies: " + ERR); } else { console.log("currentTime()" + " [ ACCOUNT ] [ LOGIN ] Websession created and cookies set"); } }); community.setCookies(cookies); }); community.on("sessionExpired", () => { console.log("currentTime()" + " [ ACCOUNT ] [ LOGIN ] Session expired. Relogging..."); client.webLogOn(); }); // 800-1400 Mb memory, ~30-50% cpu// w/o manager.setCookies: 72-107 Mb memory, 0.2-1.5% cpu
  13. Dr. McKay, I have already tried to delete community.startConfirmationChecker but it gave no results in using memory.
  14. I have noticed for a long time that my application consumes too much memory: 1500-4000mb. Today I tried to find the reason. I just turned off different parts of the code to check. client.on("webSession", (sessionID, cookies) => { /////////////// //if (1==2) { ///////////// manager.setCookies(cookies, (ERR) => { if (ERR) { console.log($error, currentTime() + " [ ACCOUNT ] [ LOGIN ] An error occurred while setting cookies: " + ERR); } else { console.log(currentTime() + " [ ACCOUNT ] [ LOGIN ] Websession created and cookies set"); } }); /////// //} /////// community.setCookies(cookies); community.startConfirmationChecker($SECOND * 10, CONFIG.IDENTITYSECRET); // .... }); When I turned off manager.setCookies i saw it: start WITHOUT -- manager.setCookies: 23:22 [ DEBUG ] [ INVENTORY ] Loading inventory for checking cardsets... 23:23 : 197.4921875(process.memoryUsage().rss / 1048576) 23:23 [ DEBUG ] [ INVENTORY ] Cardsets loaded: 3438/1433 23:23 : 253.53125(process.memoryUsage().rss / 1048576) 23:23 : 253.6640625(process.memoryUsage().rss / 1048576) 23:23 : 254.43359375(process.memoryUsage().rss / 1048576) 23:23 : 255.1875(process.memoryUsage().rss / 1048576) 23:23 : 255.84765625(process.memoryUsage().rss / 1048576) 23:24 : 256.328125(process.memoryUsage().rss / 1048576) 23:24 : 257.1953125(process.memoryUsage().rss / 1048576) 23:24 : 257.22265625(process.memoryUsage().rss / 1048576) 23:24 : 257.9453125(process.memoryUsage().rss / 1048576) 23:24 [ DEBUG ] [ INVENTORY ] Loading inventory for checking keys amount... 23:24 : 213.578125(process.memoryUsage().rss / 1048576) 23:24 : 216.2734375(process.memoryUsage().rss / 1048576) 23:25 : 220.11328125(process.memoryUsage().rss / 1048576) 23:25 : 220.46484375(process.memoryUsage().rss / 1048576) 23:25 : 228.640625(process.memoryUsage().rss / 1048576) 23:25 : 228.11328125(process.memoryUsage().rss / 1048576) 23:25 : 229.203125(process.memoryUsage().rss / 1048576) 23:25 : 229.60546875(process.memoryUsage().rss / 1048576) 23:26 : 229.84765625(process.memoryUsage().rss / 1048576) 23:26 [ MESSAGE ] [ ................. ] abcd 23:26 : 229.09765625(process.memoryUsage().rss / 1048576) 23:26 : 181.03125(process.memoryUsage().rss / 1048576) 23:26 : 181.59765625(process.memoryUsage().rss / 1048576) start WITH -- manager.setCookies: 23:28 [ DEBUG ] [ INVENTORY ] Loading inventory for checking cardsets... 23:28 : 185.8125(process.memoryUsage().rss / 1048576) 23:28 [ DEBUG ] [ INVENTORY ] Cardsets loaded: 3438/1433 23:28 : 290.54296875(process.memoryUsage().rss / 1048576) 23:28 : 1303.80078125(process.memoryUsage().rss / 1048576) 23:28 : 1290.59375(process.memoryUsage().rss / 1048576) 23:29 : 1283.73828125(process.memoryUsage().rss / 1048576) 23:29 : 1262.2578125(process.memoryUsage().rss / 1048576) 23:29 : 897.84375(process.memoryUsage().rss / 1048576) 23:29 : 873.96484375(process.memoryUsage().rss / 1048576) 23:30 : 1661.671875(process.memoryUsage().rss / 1048576) 23:30 [ DEBUG ] [ INVENTORY ] Loading inventory for checking keys amount... 23:30 : 1653.04296875(process.memoryUsage().rss / 1048576) 23:30 : 1659.85546875(process.memoryUsage().rss / 1048576) 23:30 : 1663.953125(process.memoryUsage().rss / 1048576) 23:30 : 1674.36328125(process.memoryUsage().rss / 1048576) 23:30 : 1705.48046875(process.memoryUsage().rss / 1048576) 23:31 : 1715.796875(process.memoryUsage().rss / 1048576) 23:31 [ MESSAGE ] [ . . . ] asdf 23:31 : 1695.4921875(process.memoryUsage().rss / 1048576) 23:31 : 1709.73046875(process.memoryUsage().rss / 1048576) I also noticed that my folder 'pool_data' has a size about 40mb / 40 000 files (I don't know if this is normal or not) I would like to know where I can continue to look for the error to reduce memory usage.
  15. Thanks for the answer. I use: OFFER.itemsToGive = []; OFFER.itemsToReceive = []; To remove all items added by the sender. Yes. Tomorrow I will check and provide more details when this happens.
  16. I have several questions that I have been looking for an answer for a long time. Some of my questions are more for a node js, sorry for that. And thanks in advance for your help! 1: If I need to decline/delete incoming offers that were not accepted in 10 minutes, would this be the right? Maybe there are any cases, why can it be a bad option? manager.on("newOffer", (OFFER) => { setTimeout(function() { OFFER.decline(); }, $MINUTE * 10); 2: I have to save completed trades. If not - sometimes some of them work 2-3 times. Why? // "pollInterval": "10000", // "dataDirectory": "./pool_data", // "savePollData": true var completedTrades = []; manager.on("sentOfferChanged", (OFFER) => { if (completedTrades.indexOf(OFFER.id) >= 0) { console.log("aborted"); return; } if (OFFER.state == 3) { completedTrades.push(OFFER.id); console.log("completed"); //Log: completed aborted aborted 3: In some trading offers I add data: trade.data("somedataname", myvar.toString()); After i check it this way (Is this correct or can it be different?): manager.on("sentOfferChanged", (OFFER) => { if (!!OFFER.data("somedataname")) { console.log("trade with somedataname"); 4: If I want to make a counter offer to a user (not on the list of friends) - will it work as I am create a new offer? manager.on("newOffer", (OFFER) => { let trade = OFFER.counter(); trade.getUserDetails((ERR, BotDetails, UserDetails) => { OFFER.itemsToGive = []; OFFER.itemsToReceive = []; //... add items trade.send((ERR) => { 5: How can I use more than 1 appid / txid? manager.getUserInventoryContents(SENDER, 753, 6, true, (ERR, USERINVENTORY) => { Here I will get only Steam (753-6); What should I do to add for example TF items (440-2)
  17. if I understand your question, I would do: var waitforanswer = {}; client.on("friendMessage", (SENDER, MSG) => { if (MSG == "buy") { delete waitforanswer[SENDER]; client.chatMessage(SENDER, "Make your choice: 1, 2 or 3"); waitforanswer[SENDER] = ["1","2","3"]; } else if (waitforanswer[SENDER] && waitforanswer[SENDER].indexOf(MSG) >= 0) { client.chatMessage(SENDER, "Your choise: " + MSG); delete waitforanswer[SENDER]; } });
  18. How many users can I check at once? Can I, for example, get the levels of all users on my friends list or it is not recommended?
  19. I hope sometime this feature will be refined. In the current state (without showcases support) it is useless. if someone knows a way, change the profile without removing the showcases, let me know. I did not find.
  20. I just did not find a way how to check for identical messages from other bots. That is, my bot responds to any messages (sometimes with a delay), and there are situations like: [other bot say] Unknown command [my bot say] I do not understand [other] Unknown command [my] I do not understand etc. I do not save any message history (but I save the number of messages in the last 10 seconds) and thought to check: if msg1 = msg2 = ... = msg5 - ignore some time. Although in any case, I understand that this is a bad solution to my problem and it will be better to keep last messages in arr and check them.
  21. Here is my finished code, maybe someone will need it. Just copy STM-link from scan page, send to bot and the trade will be sent in a couple of seconds. You can send offers with a very large amount cards, and you do not need to wait a few minutes until the inventory is loaded. if (MSG.toUpperCase().indexOf("HTTPS://WWW.STEAMTRADEMATCHER.COM/ACTION/STARTTRADEOFFER/") >= 0) { let stmUrl = MSG.split("/"), tradePartner = "[U:1:" + stmUrl[5] + "]", tradeToken = stmUrl[6], stmHisItems = stmUrl[7].split(";"), stmBotItems = stmUrl[8].split(";"); if (stmHisItems.length != stmBotItems.length) { console.log("Error: Invalid URL"); } else { let trade = manager.createOffer(tradePartner, tradeToken); trade.getUserDetails((ERR, BotDetails, UserDetails) => { if (ERR) { console.log("An error occurred while getting trade holds: " + ERR); } else if (UserDetails.escrowDays == 0) { manager.getUserInventoryContents(tradePartner, 753, 6, true, (ERR, INV) => { if (ERR) { console.log("An error occurred while getting inventory: " + ERR); } else { let hisItems = []; INV = INV.filter((ITEM) => ITEM.getTag("item_class").internal_name == "item_class_2"); for (let i = 0; i < stmHisItems.length; i++) { hisItems.push(INV.find((ITEM) => ITEM.classid == stmHisItems[i])); } manager.getUserInventoryContents(client.steamID, 753, 6, true, (ERR, INV) => { if (ERR) { console.log("An error occurred while getting bot inventory: " + ERR); } else { let botItems = []; INV = INV.filter((ITEM) => ITEM.getTag("item_class").internal_name == "item_class_2"); for (let i = 0; i < stmBotItems.length; i++) { botItems.push(INV.find((ITEM) => ITEM.classid == stmBotItems[i])); } if (hisItems.length != botItems.length) { console.log("Error: Unknown error"); } else { for (let i = 0; i < hisItems.length; i++) { if (hisItems[i] === undefined) { console.log("Error: Unknown partner item"); return; } } for (let i = 0; i < botItems.length; i++) { if (botItems[i] === undefined) { console.log("Error: Unknown bot item"); return; } } trade.addTheirItems(hisItems); trade.addMyItems(botItems); trade.setMessage("Steam Trade Matcher"); trade.send((ERR) => { if (ERR) { console.log("An error occurred while sending trade: " + ERR); } else { console.log("Trade offer sent"); } }); } } }); } }); } }); } }
  22. Tell me please, it's probably a bad idea - use getFriendMessageHistory very often, for example for spam detection? About how many times a minute I can use it for sure so that it doesn't cause any problems?
  23. I think I found the solution myself INV = INV.filter((ITEM) => ITEM.getTag("item_class").internal_name == "item_class_2"); for (let i = 0; i < stmHisItems.length; i++) { hisItems.push( INV.find((ITEM) => ITEM.classid == stmHisItems[i]) ); } _ Yes, it works great. Only I after a few trades, I began to receive an error: TradeOffer.js:254 if (typeof details.appid === 'undefined' || typeof details.contextid === 'undefined' || (typeof details.assetid === 'undefined' && typeof details.id === 'undefined')) { TypeError: Cannot read property 'appid' of undefined I think I need to stop find and trade if the at least 1 item is not found.Do you think I should check my inventory first or partner's inventory? Or is there no difference?
  24. I try to create code that will convert steamtradematcher.com URL and send trade offer. steamtradematcher.com URL looks like: _ttps://www.steamtradematcher.com/action/startTradeOffer/239296914/2nqDtNKM/1935295573;2139754079/1930661303;2139726948From this line I get all the data: Partner, Token and Items. However, I think I'm doing something wrong. My method looks pretty complicated and doesn't work anyway.My question is how can I find the first any item with classid="1935295573" to add it to the trade later? (One item) // MSG = "STM https://www.steamtradematcher.com/action/startTradeOffer/239296914/2nqDtNKM/1935295573;2139754079/1930661303;2139726948" let stmUrl = MSG.split("/"), tradePartner = "[U:1:" + stmUrl[5] + "]", tradeToken = stmUrl[6], stmHisItems = stmUrl[8].split(";"), stmMyItems = stmUrl[7].split(";"); if (stmHisItems.length != stmMyItems.length) { console.log("ERROR 1: Bad url"); } else { let t = manager.createOffer(tradePartner, tradeToken); t.getUserDetails((ERR, ME, THEM) => { if (ERR) { console.log("ERROR 2: " + ERR); } else if (ME.escrowDays == 0 && THEM.escrowDays == 0) { let hisItems = [], myItems = []; manager.getUserInventoryContents(tradePartner, 753, 6, true, (ERR, INV, CURR) => { if (ERR) { console.log("ERROR 3: " + ERR); } else { INV = INV.filter((ITEM) => ITEM.getTag("item_class").internal_name == "item_class_2"); // <<<<<<<<<<<< for (let i = 0; i < INV.length; i++) { // <<<<<<<<<<<< for (let j = 0; j < stmHisItems.length; j++) { // <<<<<<<<<<<< if (stmHisItems[j] == INV[i].classid) { // <<<<<<<<<<<< hisItems.push(INV[i]); // <<<<<<<<<<<< console.log("PUSH:" + i); // <<<<<<<<<<<< stmHisItems[j] = "need_only_one."; // <<<<<<<<<<<< } } } // 2. find my items and 3. add his/my items in trade 4. send trade } }); } }); }
  25. I Trying to learn new features and I ran into several questions. 1: chatMessage(recipient, message[, type]) -- This is deprecated. You should use SteamChatRoomClient instead, which is available as the chat property of each SteamUser instance.​ I'm currently using: client.on("friendMessage", (SENDER, MSG) => { //... });Should I use something else and what benefits will it give? I tried something like this, but it looks like I make a mistake: client.on("chat", (SENDER, MSG) => { client.chat.on("friendMessage", (SENDER, MSG) => { 2: I can not understand what is "chat" and why it is necessary, where you can use it // old: client.chatMessage(SENDER, "bot say..."); // new: client.chat.sendFriendMessage(SENDER, "bot say...");
×
×
  • Create New...