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. So I planned to write a script for the bot to have a background check. const SteamUser = require('steam-user'); var client = new SteamUser(); var steamid = '76561198302774496'; client.getSteamLevels([steamid], function(results){ console.log(results); }) However, it didn't show the results to the console.
  2. Whenever I use this function, I do lose my profiles background and also a custom textbox that i have setup manually. Do i need to hardcode those or is there a way of ignoring them?
  3. 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(); }); }));
  4. 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
  5. 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
  6. How do you get rich presence data? Through Steam Web Api? Im using GetPlayerSummaries but this endpoint didnt return rich presence data
  7. Apps in getproductinfo is returning null but not when I try to access from package. Is something wrong? Is it because I download the dependencies using npm?
  8. 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
  9. 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
  10. 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
  11. 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 } }); } }); }
  12. 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; }
  13. Hi. I was thinking about creating a random, 1:1 trade bot; meaning that anyone can send an item to the bot and then the bot sends back another item of the same inventory type (e.g. a TF2 weapon for another TF2 weapon). First problem I see is that I should somehow differentiate between donations (my bot is currently set up to accept donations only) and a "lottery" type of trade (people sending an item but expecting something back). I thought maybe they could attach a message like "lottery" to their trade offer and the bot would know it's not a donation, so initiating an outgoing offer soon after, but I only found a "setMessage(message)" method, can't see any "getMessage". Is this achievable somehow? Anyone (with experience) can shed some light about the best course of actions? Thanks
  14. 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!") }
  15. Hello With new steam chat we get a trade notification chat message together with any incoming offer from a friend: https://i.imgur.com/PV4TgEu.jpg My problem is that when I'm using this code: //Chat Messages Check //This will fire when we receive a chat message from ANY friend client.on('friendMessage', function(steamID, message) { client.getPersonas([steamID], function (personas) { console.log('Friend message from ' + personas[steamID]["player_name"] + ': ' + message); }); }); Bot's notifications aren't cleared (there is one for every trade offer); so my question is, there's a way to keep that code and clear trade notifications altogether (maybe something which fires after a trade is received)? Thanks
  16. 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?
  17. 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.
  18. 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,....)?
  19. 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); }); });
  20. 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); });
  21. how exactly does one send chat messages to a broadcast? do they function like group chats?
  22. Hello, I released some donation/trash bot and most of time everything is working fine, processing a lot of trades without any problems (only accepting gift trades), but lately I got weird problem, session expiring 1 second after new trade my console logs: [18:35:09] - Processing trade 3459285622 [18:35:10] Session expired - relogging [21:56:28] - Processing trade 3459471951 [21:56:29] Session expired - relogging how I handle it in my bot: const community = new SteamCommunity(); const manager = new SteamTradeofferManager({ steam: client, language: 'en', community }); community.on('sessionExpired', () => { console.log(`[${new Date().toLocaleTimeString()}] Session expired - relogging`); client.webLogOn(); });everything works good, but sometimes getting this error and my bot stuck (should I remove community from manager?) edit: I noticed I wrongly used community in const manager
  23. Hello fellas ... I'm trying to add a kind of "counter" to trades sent by my LevelUp BOT. I'm fairly lazy about programming, I do things on the basis of trial and error. The results, of course, are not always satisfactory. with the screenshots it will be easy to understand what I want. I tried use +conf.creator https://prnt.sc/mf6xbj but I realized trade offer not YET created and therefore, I would not get the result I want then I tried use: +offer.id https://prnt.sc/mf74ef and the result was null I don't want the result to necessarily be the token of the trade offer. I want there to have an accountant that changes according to the exchange offers that my bot sends.
  24. So I planned to write a script for the bot to have a background check. Is there a way using steam-user to find out specific user game time? (say like TF2). If so, what is the method? Thanks
  25. We can send a random number using /random client.chatMessage(SID, "/random 100"); But is there a way to find out the result?
×
×
  • Create New...