Jump to content
McKay Development

Search the Community

Showing results for tags 'Node.js'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • News & Announcements
    • Releases & Updates
  • Help & Support
    • General
    • Guides
    • node-steam-user
    • node-steamcommunity
    • node-steam-tradeoffer-manager
    • node-steam-session

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Skype


Location


Interests

  1. How can i loop the sender message, so that i can wait for the response of the option to be selected which was printed by the for loop Kindly View the Attached Images for an clear example: Image of the example client.on("friendMessage", (SENDER, MSG) => { ... ... else{ var countList = 1; for(var i = 0; i < listOfProducts.length; ++i){ if(listOfProducts[i].is_free_license == false){ client.chatMessage(SENDER, countList +". "+listOfProducts[i].option_text) ountList++; } else{ client.chatMessage(SENDER, result[0].name + ", Unfortunately you can not buy this game as a gift.") } } console.log(countList); client.on("friendMessage", (SENDER, MSG) => { countList = countList - 1; if (MSG === 1) { client.chatMessage(" has been added to the Cart.") } }); } ... ... }); Kindly drop your suggestions... and thank you for your precious time.
  2. const SteamUser = require('steam-user');const SteamTotp = require('steam-totp');const SteamCommunity = require('steamcommunity');const TradeOfferManager = require('steam-tradeoffer-manager'); const client = new SteamUser();const community = new SteamCommunity();const manager = new TradeOfferManager({ steam: client, community: community, language: 'en'}); const logInOptions = { accountName: "........", password: "...........", twoFactorCode: SteamTotp.generateAuthCode("............")}; client.logOn(logInOptions); client.on('loggedOn', () => { console.log('logged on');client.setPersona(SteamUser.EPersonaState.Online, "bot1");client.gamesPlayed(570);});client.on('webSession', (sid, cookies) => {console.log(cookies); manager.setCookies(cookies); community.setCookies(cookies); community.startConfirmationChecker(10000, "............"); mytrade();}); manager.on('newOffer', offer => { console.log('offer detected'); if (offer.partner.getSteamID64() === '.............') { offer.accept((err, status) => { if (err) { console.log(err); } else { console.log(status); } }) } else { console.log('unknown sender'); offer.decline(err => { if (err) { console.log(err); } else { console.log('trade from stranger declined'); } }); }}); function mytrade() {manager.getOfferToken((err, token) => {if (err) {console.log("gsfgfasy", err)}else {var partner="id........"const offer = manager.createOffer('id.....',token);manager.getUserInventoryContents(partner,570, 2, true, (err, myInv) => {if (err) {console.log(err);} else {console.log("myenv",myInv[0]);// myInv.forEach(function(item) {offer.addTheirItem(myInv[0]);offer.setMessage('You received a floral shirt!');offer.send((err, status) => {if (err) {console.log(err);} else {console.log('trade sent');console.log(status);}}) // })}}) }})}
  3. Hi, im new to this and i don't know how to check if the key is valid or invalid.. This is the code client.on("friendMessage", function (steamID, message) { if (steamID == AdminID && message.indexOf('!key') == 0) { var GetKey = message.replace('!key ', ''); client.redeemKey(GetKey); client.chatMessage(steamID, "Key activated: " + GetKey); } }); Thanks
  4. Why doesn't this work? const SteamCommunity = require('steamcommunity'); let community = new SteamCommunity(); community.login({ "accountName": "accountName", "password": "password", }); community.loggedIn(() => { console.log("test"); }); Of course, I use proper login and password. And I get this when I run it:
  5. So I'm using getUserInventoryContents for someone who uses my bot to check his inventory and see if I have items that my bot accepts. https://pastebin.com/sXYvkTMD All works out but it does not give all the items results than it should. For example, I have 6 SF arcanas but it only tells me 4. Also what may be the reason why I get "TypeError: Cannot read property 'EPersonaState' of undefined" in my linux and in my windows it works perfectly fine.
  6. Hello, I just started building my steam level up bot and couldn't code it when someone adding him to tell 'Hello, "Persona Name" Thank you for adding me'. this is the code i put it from another question but its sending 'Hello, [steamID] Thank you for adding me'. client.getPersonas([steamID], function(personas) { var persona = personas[steamID.getSteamID64()]; var name = persona ? persona.player_name : ("[" + steamID.getSteamID64() + "]"); }); client.chatMessage(steamID, 'Hi ' + name + ' Thank you for adding me!'); } });
  7. Hey, is it possible to retrieve these values using the npm's on this forum? or will I need an API? Does any1 knows of any? thank you!
  8. So just trying to figure out if I'm dumb or if something is up. I'm updating my bot manager and since update doesn't use steam-client anymore I can't use .bind() which was working. See my attached image. Basically client is still returning my own localhost IP. Not the proxy one I'm setting.
  9. how to set proxy for this? const SteamCommunity = require('steamcommunity'); let community = new SteamCommunity(); var details = { "accountName": login, "password": pass, "twoFactorCode": 2fa } await (new Promise((resolve, reject) => { community.login(details,function(err,sessionID,cookies,steamguard,oAuthToken){ console.log(err); console.log(sessionID); console.log(cookies); console.log(steamguard); console.log(oAuthToken); resolve(); }); }));
  10. How do you get rich presence data? Through Steam Web Api? Im using GetPlayerSummaries but this endpoint didnt return rich presence data
  11. Hey, I'm trying to retrieve the items im getting in trades, but problem is I can't do that when my language is removed from my client constructor let client = new SteamUser(), manager = new TradeOfferManager({ "steam": client, "pollInterval": "10000", "cancelTime": "1800000" }), Is there a work around? I had to remove language, and adding it back isn't an option
  12. Guest

    Get chat history

    Hi, how can i get full chat history like in as steam chat ? When I using client.getChatHistory() I getting less messages than in steam chat in web browser, and after several times using this method - history would clear. Can you add the method like in steam web chat for getting full history ? through websocket method or smth
  13. Hey, so Im trying to get the market price of an item I receive on a trade. It works, but for some reason the script won't wait for my async function to finish and returns an empty result First I have this function which is triggered when I receive an offer for their items async function ProccessTradeOffer(offer){ let TheirItems = offer.itemsToReceive; const Deposited_Items = await ConvertToKeys2(TheirItems); console.log(Deposited_Items); // this will print null and won't wait for the async to finish } This is the other function im calling async function ConvertToKeys2(Items){ let ValueInKeys = []; // array of objects containing info about the items return new Promise(resolve => { setTimeout(() => { if(Market_Value > -1){ obj = { name: item_name, value: Market_Value } ValueInKeys.push(obj); } }, 2000); }); } } return ValueInKeys; } The problem is that in the main async function it'll not wait for my ConvertToKeys2 function to calculate & add it to array and simply print an empty array. It's an async function so I don't understand why thisis happening.. Thx for your help
  14. I wrote an application that idles all of my games to x amount of minutes. My problem is that after logging in and passing some appIds to gamesPlayed, I am being prompted to enter my Steam Guard code after a while. I have had it run fine for over 30 minutes sometimes before being asked, but it's usually within 5-10 minutes. I'm listening to both sessionExpired and error, but it doesn't seem to be either of them. The goal is to log on just once and have it idle games until the application is closed. I call webLogOn every 15 minutes, but that doesn't seem to be the problem, as I'm usually prompted before that. I've also tried assigning the loginKey to my log in options after first logging in, which supposedly omits the need for a guard code, but that doesn't work either. Why is this happening? Any help would be greatly appreciated. Code: global._mckay_statistics_opt_out = true; const SteamClient = require('steam-user'); const SteamCommunity = require('steamcommunity'); const community = new SteamCommunity(); const client = new SteamClient(); let apiKey = (''); const minutesToIdle = 180; let gamesToIdle = []; let gamesTimePlayed = []; let appNames; let steamID; const logInOptions = { accountName: '', password: '', logonID: Date.now(), rememberPassword: true }; // Initialize (function () { console.log('Loading game names...') community.request('some api', (error, response, data) => { if (!error && response.statusCode == 200) { appNames = JSON.parse(data).data; client.logOn(logInOptions); } else { console.log('Failed to get game names, listing AppIDs instead.') setTimeout(function() { client.logOn(logInOptions); }, 4000); } }) })() client.on("webSession", (sessionID, cookies) => { console.clear(); console.log("Got web session"); community.setCookies(cookies); getGamesInfo(); }); // Get owned games and time information. function getGamesInfo () { gamesToIdle.length = 0; gamesTimePlayed.length = 0; console.log('\x1b[36m%s\x1b[0m', 'Idle all Steam games'); community.request('https://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?key=' + apiKey + '&steamid=' + steamID, (error, response, data) => { if (!error && response.statusCode == 200) { const gamesData = JSON.parse(data); const gamesTotal = gamesData.response.game_count; console.log('\x1b[32m%s\x1b[0m', '\nAmount of games: ' + gamesTotal); // Check playtime for past 2 weeks and forever. for (var i = 0; i < gamesTotal; i++) { if (gamesData.response.games[i].playtime_forever < minutesToIdle) { if (gamesData.response.games[i].playtime_2weeks == null || gamesData.response.games[i].playtime_2weeks < minutesToIdle) { gamesToIdle.push(gamesData.response.games[i].appid); gamesTimePlayed.push(getMostTime(gamesData.response.games[i].playtime_forever, gamesData.response.games[i].playtime_2weeks)); } } } if (gamesToIdle.length > 1 ) { console.log('\x1b[32m%s\x1b[0m', 'Games left to idle: ' + gamesToIdle.length); assignAppNames(); } else { console.log('Done idling.') } } else { console.log('Error loading games, retrying in 1 minute...'); setTimeout(function() { client.webLogOn(); }, 600000); } }) } // Returns most time played between last 2 weeks and forever. function getMostTime (a, { if (a > { return a; } else { return b; } } // Assigns app names to display, or appIDs if none found. function assignAppNames () { let gameNames = []; for (var i = 0; i < 29 && i < gamesToIdle.length; i++) { if (appNames != null && appNames.hasOwnProperty(gamesToIdle[i])) { gameNames.push(appNames[gamesToIdle[i]]); } else { gameNames.push(gamesToIdle[i]); } } idleGames(gameNames); } // Idle the games. function idleGames (gameNames) { let idleNow = []; for (var i = 0; i < 29 && idleNow.length < gamesToIdle.length; i++) { idleNow.push(gamesToIdle[i]); } client.gamesPlayed(idleNow); console.log('\x1b[32m%s\x1b[0m', 'Now idling: ' + idleNow.length + '\n') gameNames.forEach(function(element) { console.log(element + '\x1b[33m%s\x1b[0m', ' [' + (gamesTimePlayed[gameNames.indexOf(element)] / 60).toFixed(2) + ']'); }) console.log('\n' + 'Last update: ' + '\x1b[33m%s\x1b[0m', getDateTime()); setTimeout(function() { client.webLogOn(); }, 900000); } community.on("sessionExpired", error => { console.log("Steam web session expired: " + error.message); if (client.steamID) { client.webLogOn(); } else { client.logInOptions.logonID = Date.now(); client.logOn(logInOptions); } }); client.on("error", error => { console.log("An error has occurred: " + error.message); } ); client.on('loggedOn', (details) => { console.log('Logged on Steam.'); client.setPersona(SteamClient.EPersonaState.Invisible); steamID = details.client_supplied_steamid; }); function getDateTime() { var date = new Date(); var hour = date.getHours(); hour = (hour < 10 ? "0" : "") + hour; var min = date.getMinutes(); min = (min < 10 ? "0" : "") + min; var sec = date.getSeconds(); sec = (sec < 10 ? "0" : "") + sec; var year = date.getFullYear(); var month = date.getMonth() + 1; month = (month < 10 ? "0" : "") + month; var day = date.getDate(); day = (day < 10 ? "0" : "") + day; return hour + ":" + min + ":" + sec; }
  15. Hi. I'm migrating from v3 to v4, and trying to redeem Steam key. I added err argument as described in release notes, and now have the following code: client.redeemKey(key, (err, detail, packages) => { if (err) { console.log('Can not redeem: ' + SteamUser.EPurchaseResultDetail[detail]); return; } console.log('Redeemed!'); }); If key can not be redeemed, in v3 I get detailed reason, for example DoesNotOwnRequiredApp. But in v4 detail argument seems to be undefined. How can I access this info now, after migration to v4? Thanks
  16. Hello, i have a question do anyone have idea how to make a diffrent texts after trade is accepted by person who write command i have in mind something line when buyer use !buytf > get offer > accept it > get a message with other bot who sell tf keys etc if he use !buycs he get message with bot who sell csgo keys and thats my question idk who to make it in 100% i know i can make 1 message if (TradeOfferManager.ETradeOfferState[OFFER.state] == 3) { client.chatMessage(OFFER.partner, " Thanks for trading with me!") }
  17. HI, I wanna try to edit my profile name function setupProfile(username) { community.editProfile({ 'name' : username, }, function(err) { if (err) { console.log('Failed to Edit Profile'); console.log(err); } }); } but I got this error Failed to Edit Profile Error: Not Logged In at SteamCommunity._checkHttpError (E:\new\steambot\node_modules\steamcommunity\components\http.js:95:9) at Request._callback (E:\new\steambot\node_modules\steamcommunity\components\http.js:50:61) at Request.self.callback (E:\new\steambot\node_modules\request\request.js:185:22) at Request.emit (events.js:182:13) at Request.<anonymous> (E:\new\steambot\node_modules\request\request.js:1161:10) at Request.emit (events.js:182:13) at Gunzip.<anonymous> (E:\new\steambot\node_modules\request\request.js:1083:12) at Object.onceWrapper (events.js:273:13) at Gunzip.emit (events.js:187:15) at endReadableNT (_stream_readable.js:1094:12) as you can see that give me error Not Logged In but u can see my screenshot I already login to account,please help
  18. Hi, Currently I'm using v3 version: const Steam = require('steam-client'); const SteamUser = require('steam-user'); const SteamCommunity = require('steamcommunity'); const TradeOfferManager = require('steam-tradeoffer-manager'); let client = new Steam.CMClient(); client.setHttpProxy(proxyUrl); let user = new SteamUser(client, { debug: true, singleSentryfile: false, autoRelogin: true, dataDirectory: '/files/clients' }); let community = new SteamCommunity(); let manager = new TradeOfferManager({ steam: user, community: community }); And in v4 I should change to: const SteamUser = require('steam-user'); const SteamCommunity = require('steamcommunity'); const TradeOfferManager = require('steam-tradeoffer-manager'); let user = new SteamUser({ debug: true, singleSentryfile: false, autoRelogin: true, dataDirectory: '/files/clients' }); user.setHttpProxy(proxyUrl); let community = new SteamCommunity(); let manager = new TradeOfferManager({ steam: user, community: community }); Can you advice please? NOTE: so v4 node-user replaces steam-client?
  19. I've written some lines to check the user background but I don't know how to get all of the items I am receiving and giving. const requestReview = (offer) => { var user = offer.partner.getSteamID64(); for(i = 0; i < offer.itemsToGive.length; i++){ var giveItems = offer.itemsToGive[i].market_hash_name; } for(i = 0; i < offer.itemsToReceive.length; i++){ var receiveItems = offer.itemsToReceive[i].market_hash_name; } client.chatMessage(config.bossSteamID, "--------------------------------"); client.chatMessage(config.bossSteamID, "User "+user+" sent an offer above 14 keys in value. Requesting manual review..."); client.chatMessage(config.bossSteamID, "User Backpack.tf: https://backpack.tf/profiles/"+user); client.chatMessage(config.bossSteamID, "Item to receive: " + receiveItems); client.chatMessage(config.bossSteamID, "Item to give: " + giveItems); client.chatMessage(config.bossSteamID, "Offer ID"); client.chatMessage(config.bossSteamID, offer.id); client.chatMessage(config.bossSteamID, "--------------------------------"); backgroundCheck(offer); } Right now, it would only send me the last item in the trade offer and I would like to modify it to give me all the names in the trade offer. Also is there a way to make it so it can show (ie. 19x keys, 20x ref) instead of all items with just ( , ) separating them (like keys, keys,....)?
  20. You know, I've been trying to find out whether or not this is allowed and every time I ask Valve they refuse to answer. They deliberately say they can not answer. There was someone who tried to explain how to use this script to change your name yellow, but I didn't quite understand really. I'm not a coder really and all I was looking for is a way to change my name yellow in a simple safe way. I don't even know what this tool of yours does or how to run it even. But I am hoping you might be able to shed some light on whether or not Steam till ban people for using it to make their names yellow/gold. If it is allowed, is there a simple thing I can just run once to set my state? I have no idea what this thing is or does. Just an average user looking to set their name to gold using the "PersonaStateFlags" #4.
  21. Hey, so I'm trying to get user's personaName in a sent trade offer. I'm pretty sure I'm doing this right, but I can't figure out what's causing the error.. manager.on("sentOfferChanged", (OFFER, OLDSTATE) => { OFFER.getUserDetails((err, me, them) => { theirname = them.personaName; console.log(theirname); }); });
  22. 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 } }); } }); }
  23. C:\Users\lokin\node_modules\steam-tradeoffer-manager\lib\classes\TradeOffer.js:255 throw new Error("Missing appid, contextid, or assetid parameter"); ^ Error: Missing appid, contextid, or assetid parameter at addItem (C:\Users\lokin\node_modules\steam-tradeoffer-manager\lib\classes\TradeOffer.js:255:9) at TradeOffer.addMyItem (C:\Users\lokin\node_modules\steam-tradeoffer-manager\lib\classes\TradeOffer.js:167:9) at C:\Users\lokin\OneDrive\New folder\bot.js:48:23 at SteamCommunity.<anonymous> (C:\Users\lokin\node_modules\steamcommunity\components\users.js:384:5) at Request._callback (C:\Users\lokin\node_modules\steamcommunity\components\http.js:67:15) at Request.self.callback (C:\Users\lokin\node_modules\request\request.js:185:22) at Request.emit (events.js:182:13) at Request.<anonymous> (C:\Users\lokin\node_modules\request\request.js:1161:10) at Request.emit (events.js:182:13) at Gunzip.<anonymous> (C:\Users\lokin\node_modules\request\request.js:1083:12) Error ^^ I found some examples of creating trade offers on steam but I don't quite understand how to do it. I would like to first differentiate the refined metal from the TF2 inventory and send a certain number (eg 5 refined metal) to the owner when it has more than 5 in its backpack. const SteamUser = require('steam-user'); const SteamCommunity = require('steamcommunity'); const SteamTotp = require('steam-totp'); const TradeOfferManager = require('steam-tradeoffer-manager'); const config = require('./config'); let client = new SteamUser(); let manager = new TradeOfferManager({ "steam": client, // Polling every 30 seconds is fine since we get notifications from Steam "domain": "example.com", // Our domain is example.com "language": "en" // We want English item descriptions }); let community = new SteamCommunity(); // Steam logon options let logOnOptions = { "accountName": config.accountName, "password": config.password, "twoFactorCode": SteamTotp.getAuthCode(config.shared_secret) }; client.logOn(logOnOptions); client.on('loggedOn', function() { console.log("Logged into Steam"); }); client.on('webSession', function(sessionID, cookies) { manager.setCookies(cookies, function() { manager.loadInventory(440, 2, true, function(err, inventory) { if (err) { console.log(err); return; } console.log("Found " + inventory.length + " Team Fortress 2 items"); console.log(inventory); var ref = 0; for (var i = 0; i < inventory.length; i++){ if(inventory[i].market_hash_name == 'Refined Metal'){ ref++ var metal = inventory[i].assetid; } } console.log(metal); if(ref >= 5){ //I want to send 5 metal when the bot backpack has enough metal in its backpack console.log('We have enough refined metal. Sending the trade'); let offer = manager.createOffer(config.bossID); offer.addMyItem(metal); offer.send(function(err, status) { if (err) { console.log(err); return; } if (status == 'pending') { console.log(`Offer #${offer.id} sent, but requires confirmation`); community.acceptConfirmationForObject(config.identity_secret, offer.id, function(err) { if (err) { console.log(err); } else { console.log("Offer confirmed"); } }); } else { console.log(`Offer #${offer.id} sent successfully`); } }); } }); }); community.setCookies(cookies); });
  24. Hello Error: Must be logged in before trying to do anything with confirmations I get this error when executing code in BAS (Browser Automation Studio) [[IDENTITY_SECRET]] = JSON.parse([[FILE_CONTENT]]).identity_secret var SteamTotp = require('steam-totp'); [[code2]] = SteamTotp.generateConfirmationKey([[IDENTITY_SECRET]]); [[code3]] = SteamTotp.getConfirmationKey([[code2]]); [[TIME]] = SteamTotp.time([[timeOffset]]); var SteamCommunity = require('steamcommunity'); var community = new SteamCommunity(); var Steam = require('steam-client'); var client = new Steam.CMClient(Steam.EConnectionProtocol.TCP); var TradeOfferManager = require('steam-tradeoffer-manager'); var manager = new TradeOfferManager(); client.on('webSession', (sessionID, cookies) => { manager.setCookies(cookies, function (err) { if (err) { logger.error(err) //игнор.прав process.exit(1); } }); community.setCookies(cookies); community.startConfirmationChecker(10000, [[code3]]); }); var time = [[TIME]]; var confKey = [[code3]]; var allowKey = [[code3]]; community.acceptAllConfirmations(time, confKey, allowKey, function(err, confs){ if(err){ res.sendError(err); return; } if(confs == null) confs = []; res.sendSuccess(confs); });
×
×
  • Create New...