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. Hi, im sorry to bother you but i need a litte bit of help. I need to find, how to get my sended offers and to be honest, I dont even know where to start, what function use and even if its possible or if i will need o save every trade i send. Thank you
  2. I'm running a bot and the majority of trade offers are not going through. The bot logs in and handles expired sessions like this: let client = new SteamUser(); let community = new SteamCommunity(); let manager = new TradeOfferManager({ community: community, steam: client, domain: "example.com", language: "en", pollInterval: 2000 }); let logOnOptions = { "accountName": data.username, "password": data.password, "twoFactorCode": SteamTotp.getAuthCode(data.shared_secret) }; client.logOn(logOnOptions); client.on('loggedOn', function() { console.log("Logged into Steam"); client.setPersona(SteamUser.EPersonaState.Online); }); client.on('webSession', function(sessionID, cookies) { manager.setCookies(cookies); community.setCookies(cookies); console.log("weblogon") }); community.on("sessionExpired", function(err) { console.log("## Session Expired"); client.webLogOn(); }); The bot gets new offers with manager.on('newOffer', function(offer) { , makes a simple request using https://www.npmjs.com/package/request and calls offer.getUserDetails. An offer is accepted like this: offer.accept(accept(offer, 1)); These are the two functions that handle accepting and confirming trades: function confirm(offer, count) { return function(err) { if (err) { if (count < 20) { console.log(err); setTimeout(community.acceptConfirmationForObject, 10000, data.identity_secret, offer.id, confirm(offer, count + 1)); } else { console.error("CONFIRM FUNCTION: "); console.error(err); } } } } function accept(offer, count) { return function(err, status) { if (err) { if (count < 20) { console.log(err); setTimeout(offer.accept, 10000, accept(offer, count + 1)); } else { console.error("ACCEPT FUNCTION: "); console.error(err); } } else { if (status === "pending") { community.acceptConfirmationForObject(data.identity_secret, offer.id, confirm(offer, 1)); } } } } Whenever I run the code it works for a few hours accepting offers and confirming them. Then offer comes in and the sessionExpired and webSession events are emitted twice. Error: Cannot accept an unsent offer happens every time it tries to accept the offer. This from stdout (it also logs the timestamp): 16:31:23 Error: Not Logged In at SteamCommunity._checkCommunityError (/home/user/bot/node_modules/steamcommunity/components/http.js:128:9) at Request._callback (/home/user/bot/node_modules/steamcommunity/components/http.js:51:88) at Request.self.callback (/home/user/bot/node_modules/request/request.js:185:22) at emitTwo (events.js:126:13) at Request.emit (events.js:214:7) at Request.<anonymous> (/home/user/bot/node_modules/request/request.js:1161:10) at emitOne (events.js:116:13) at Request.emit (events.js:211:7) at Gunzip.<anonymous> (/home/user/bot/node_modules/request/request.js:1083:12) at Object.onceWrapper (events.js:313:30) 16:31:23 ## Session Expired 16:31:23 ## Session Expired 16:31:23 Error: Not Logged In at SteamCommunity.manager._community.httpRequestPost (/home/user/bot/node_modules/steam-tradeoffer-manager/lib/classes/TradeOffer.js:483:25) at Request._callback (/home/user/bot/node_modules/steamcommunity/components/http.js:67:15) at Request.self.callback (/home/user/bot/node_modules/request/request.js:185:22) at emitTwo (events.js:126:13) at Request.emit (events.js:214:7) at Request.<anonymous> (/home/user/bot/node_modules/request/request.js:1161:10) at emitOne (events.js:116:13) at Request.emit (events.js:211:7) at IncomingMessage.<anonymous> (/home/user/bot/node_modules/request/request.js:1083:12) at Object.onceWrapper (events.js:313:30) 16:31:23 weblogon 16:31:24 weblogon 16:31:33 Error: Cannot accept an unsent offer at Timeout.TradeOffer.accept [as _onTimeout] (/home/user/bot/node_modules/steam-tradeoffer-manager/lib/classes/TradeOffer.js:451:23) at ontimeout (timers.js:502:15) at tryOnTimeout (timers.js:323:5) at Timer.listOnTimeout (timers.js:290:5) 16:31:43 Error: Cannot accept an unsent offer at Timeout.TradeOffer.accept [as _onTimeout] (/home/user/bot/node_modules/steam-tradeoffer-manager/lib/classes/TradeOffer.js:451:23) at ontimeout (timers.js:502:15) at tryOnTimeout (timers.js:323:5) at Timer.listOnTimeout (timers.js:290:5) ... etc What am I doing wrong?
  3. Error: Already logged on, cannot log on again Why crashing script? :// after hours
  4. my bot is getting web session expired and i use community.on('sessionExpired', function(err) { if (err) { console.log('sessionExpired: '+err); } if (client.steamID) { client.webLogOn(); } else { client.logOn(logon_details); } });this code is triggered when the user of bot tried to make the bot start a trade offer. what is a simple way for me to trigger session expired like every 15 mins if the session has expired? Ans- A simple http request every 15 mins using node-cron to trigger it. (i am not a coder so if u could show it to me thanks!) Right now the user of bot triggers it then has to wait 1-2 mins then the bot webLogon() and then sends trade offer Alternative 2 it was suggested in forum we can use direct cronschedule that does webLogOn() every 15 min , and whenever that error fires I also do a webLogOn(). but idk what will happen if i try to webLogON() if the session hasnt been expired yet thats y i wanted to set up Alternative 1
  5. So, i would like to search for specific items (keys). Code: community.getUserInventoryContents(steamid, 730, 2, true, (err, inventory) => {if (err) {throw err;}else{for(var i = 0, len = inventory.length; i < len; i++){var itemnames = inventory.market_hash_name;}var found = itemnames.search("R8 Revolver | Bone Mask (Well-Worn)");if(found != -1) {console.log();}console.log(itemnames);console.log (found); } I would like to write a code which is search for a specific item, then check this item's amount and then do something, but i'm new at nodeJS so i don't know so many things.Please Help, or give me some docs. Tnanks
  6. community.getUserInventoryContents(partner, 753, 6, true, (error, items) => { if(error) { users.removeReservation(partner, true, removeFunc); return callback(error); } let count = 0; for(let i = 0; i < items.length; i++) { let item = items[i]; if(item.type.toLowerCase() != "Trading Card") continue; count += item.amount; if(count > price) { item.amount -= (count - price); count -= (count - price); } offer.addTheirItem(item); if(count == price) break; } if(count < price) { users.removeReservation(partner, true, removeFunc); return callback("You do not have enough gems to purchase random games."); } if(count > price) { users.removeReservation(partner, true, removeFunc); return callback("An unexpected error occurred, please try again."); } offer.send((error, status) => { if(error) { users.removeReservation(partner, true, removeFunc); return callback(error); } if(status == "pending") { community.acceptConfirmationForObject(files.getConfig().identity, offer.id, error => { if(error) { users.removeReservation(partner, true, removeFunc); return callback(error); } callback(null, "https://steamcommunity.com/tradeoffer/" + offer.id); }); } else if(status == "sent") callback(null, "https://steamcommunity.com/tradeoffer/" + offer.id); }); }); break; default: users.removeReservation(partner, true, (error) => { if(error) return callback(error); return callback("Invalid payment method"); }); } }); }); } Where is my fault?
  7. Hello. I'm new to all this stuff, so just a generic question before I dig further in. Can I create a bot which only accepts donations (i.e. no item loss from bot side) if the associated steam account doesn't use Mobile 2FA but is not a limited account (using email auth)? I'm asking because trying this code... client.on('webSession', (sessionid, cookies) => { manager.setCookies(cookies); community.setCookies(cookies); community.startConfirmationChecker(10000, 'my_identity_secret'); }); ...I'm not sure how to avoid that "identity_secret" argument. Thanks
  8. But steam-user inviteToGroup works fine. Though earlier inviteUserToGroup worked as it should.Can you tell me why ?
  9. I want take random 5 trading cards how can i do ? i use this; community.getUserInventory(partner, 753, 6, true, (error, items) => {if(error) {users.removeReservation(partner, true, removeFunc);return callback(error);} let count = 0; for(let i = 0; i < items.length; i++) {let item = items; if(item.type.toLowerCase() != "Steam Trading Cards")continue; count += item.amount; if(count > price) {item.amount -= (count - price);count -= (count - price);} offer.addTheirItem(item); if(count == price)break;} But dont working help me please
  10. Hello there, I am very new to node.js and learning step by step, I had a look at many topics in this forum to learn some basics of trading codes, I need little help here, I want to connect to database, retrieve steam trading card names from database (like Alpaca Mage, Mysterious Card 4 etc.) and send a trade offer containing only those trading cards. I also want my bot to check my database like every 10 seconds and if a value i want is found, it will create a trade offer. Is something like this possible ? Thanks in advance
  11. http://prntscr.com/lv0q6u my developer is busy for few days. can anyone give me any idea why this happens so i could fix it? it happens after 24 hrs etc when bot is working
  12. Hello, can I somehow interact when one of my friends gets online? best regards Kingnemehl
  13. Is there any way to learn if an offer between 2 different steam accounts (that are not mine) got accepted or declined ? I would like to create a website in which people advertise their cs go skins and others buy it, the skins are traded via their own steam accounts but i need to learn if the skin gets to buyer or not ? Is there any way to do that ? Thanks in advance
  14. Hy, i'm new in node js, my english is not that good. First, i wanna make a script which is load the player's inventory, accept all keys expect low price keys (like hydra case key or CSGO capsulekey),t hen select ? keys (depends on what command he uses in the chat (!buyadmin->3keys, !buyvip->2keys)). After the select, the bot will send an offer for the keys and he gets his rank (I can make this part). I have a starter script (I tried to learn and code something). Code: const SteamUser = require('steam-user'); const SteamTotp = require('steam-totp');const SteamID = require('steamid');const SteamCommunity = require('steamcommunity');const TradeOfferManager = require('steam-tradeoffer-manager');const config = require('./config.json'); const client = new SteamUser();const community = new SteamCommunity();const manager = new TradeOfferManager({ steam: client, community: community, language: 'en'}); const logOnOptions = { accountName: config.username, password: config.password, twoFactorCode: SteamTotp.generateAuthCode(config.sharedSecret)}; client.logOn(logOnOptions); client.on('loggedOn', () => { console.log('[Vortex] Sikeres bejelentkezés a steam-be!'); client.setPersona(SteamUser.Steam.EPersonaState.Online); client.gamesPlayed(730);}); client.on('webSession', (sessionid, cookies) => { manager.setCookies(cookies); community.setCookies(cookies); community.startConfirmationChecker(10000, config.identitySecret);}); manager.on('newOffer', offer => { if (offer.partner.getSteamID64() === 'config.owenerID') { offer.accept((err, status) => { if (err) { console.log(err); } else { console.log(`[Vortex] Owner csereajánlat elfogadva. Státusz: ${status}.`); } }); } }); client.on("friendMessage", function(steamID, message) { if (message == "!help") { client.chatMessage(steamID, "[Vortex] Parancsok: !weboldal, !szerverek, !rangok, !adminok, !buyadmin, !buyvip+, !buyvip, !buypskin");console.log(steamID.getSteam2RenderedID()); } if (message == "!weboldal") { client.chatMessage(steamID, "[Vortex] Weboldalunk: ");console.log(steamID.getSteam2RenderedID()); } if (message == "!szerverek") { client.chatMessage(steamID, "[Vortex] Szervereink: ");console.log(steamID.getSteam2RenderedID()); } if (message == "!rangok") { client.chatMessage(steamID, "[Vortex] Rangok: ");console.log(steamID.getSteam2RenderedID()); } if (message == "!adminok") { client.chatMessage(steamID, "[Vortex] Adminok: ");console.log(steamID.getSteam2RenderedID()); } if (message == "!buyadmin") { client.chatMessage(steamID, "[Vortex]");const steam2id = (steamID.getSteam2RenderedID());const steamid = (steamID.getSteamID64());const offer = manager.createOffer(steamid); community.getUserInventory(steamid, 730, 2, false, function(err, inventory) {console.log(inventory[0].amount);}); } if (message == "!buyvip+") { client.chatMessage(steamID, "[Vortex]"); } if (message == "!buyvip") { client.chatMessage(steamID, "[Vortex]");console.log(steamID.getSteam2RenderedID()); } if (message == "!buypskin") { client.chatMessage(steamID, "[Vortex]");console.log(steamID.getSteam2RenderedID()); } if (message != "!help" && message != "!weboldal" && message != "!rangok" && message != "!adminok" && message != "!buyadmin" && message != "!buyvip+" && message != "!buyvip" && message != "!buypskin"){client.chatMessage(steamID, "[Vortex] Nincs ilyen parancs, segítségért írd be: !help");}}); manager.on('newOffer', offer => { if (offer.itemsToGive.length === 0) { offer.accept((err, status) => { if (err) { console.log(err); } else { console.log('[Vortex] Támogatás elfogadva. Státusz: ${status}.'); } }); } else { offer.decline(err => { if (err) { console.log(err); } else { console.log('[Vortex] Támogatás elutasítva. (Tárgyat akart kérni a bot-tól!)'); } }); }}); (steamID.getSteam2RenderedID()); -> I need this for sourcemod admin setup.
  15. i'm getting the callback is not a function in the steamcommunity/user.js:484 file I have no idea what line of code of mine is causing this, I am trying to make a level bot and get all the sets in our inventory and add as many sets until the amount is reached which is the buyRate * how many keys the user wants to use. error D:\Documents\Google Drive\Node\SteamBot\node_modules\steamcommunity\components\users.js:484 callback(null, inventory, currency, body.total_inventory_count); ^ TypeError: callback is not a function at SteamCommunity.<anonymous> (D:\Documents\Google Drive\Node\SteamBot\node_modules\steamcommunity\components\users.js:484:5) at Request._callback (D:\Documents\Google Drive\Node\SteamBot\node_modules\steamcommunity\components\http.js:67:15) at Request.self.callback (D:\Documents\Google Drive\Node\SteamBot\node_modules\request\request.js:185:22) at Request.emit (events.js:182:13) at Request.<anonymous> (D:\Documents\Google Drive\Node\SteamBot\node_modules\request\request.js:1161:10) at Request.emit (events.js:182:13) at IncomingMessage.<anonymous> (D:\Documents\Google Drive\Node\SteamBot\node_modules\request\request.js:1083:12) at Object.onceWrapper (events.js:273:13) at IncomingMessage.emit (events.js:187:15) at endReadableNT (_stream_readable.js:1086:12) and here is the code that is possibly causing the error ( I am also using https://www.npmjs.com/package/steam-market-search for the market search as I couldn't get the one in steamcommunity to work) for(var i = 0; i < cardApps.length; ++i){ //Loop through all the appid's we have steamMarket.searchCommunity(cardApps[i]).then(function(item){ //searches steam market for the appid var itemCount = 0; var cards = []; for(var j = 0; j < item.length; ++j){ //loop through each item if(item[j].type.includes('Trading Card') && item[j].rarity.includes('Normal')){ //if they are a normal trading card ++itemCount; var ata = 0; if(ata <= cardApps[i].amountToAdd){ for (let y = 0; y < myItems.length; ++y) { //loop through all our items if(myItems[y].market_hash_name == myItems[j].hash_name){ //if our item matches the one we are currently looking at cards.push({id: myItems[y].id, appid: 753, contextid: 6}); // add to item array ++ata; } } } } if(cards.length == itemCount){ offer.addMyItems(cards); cardApps.splice(i, 1); } } }, console.error); }
  16. help i can accept the offer in web but can't accept it with node-steamcommunity in some reason our country block the steamcommunity.com when we visit the site our targetlink will be reset,so if we want visit steamcommunity.com we must use a vpn and one day some one find the way to visit it without vpn it's called Reverse Proxy, i thought.(sry for my bad english) The question is now i can visit steamcommunity.com with web and steamclient, but i can't visit is by node-steamcommunity the first offer worked becacuse i use a another ipaddress in hosts, and then i change the hosts to my Reverse Proxy server, and then show Unable to accept offer: self signed certificate what should i do ? can you give me some suggestions? I am very grateful to you for reading these. thanks
  17. Hello, I don't really know if I'm doing it right. I have VPS (where I idle steam game hours) and I have 2 the same idle scripts on VPS (different IP) and on local PC. Sometimes I need to run idle script on local PC without killing session on VPS, but I getting error: LoggedInElsewhere, and I can't login with local PC, so I decided to try kickPlayingSession. using this script: click bot.setPersona(SteamUser.EPersonaState.Offline); bot.kickPlayingSession((callback) => { console.log(callback) }); bot.gamesPlayed(this.games, true);then I getting crash in my app with: Error: Cannot kick other sessionbut orginal session getting error too: LoggedInElsewhere, but its not crashing can you please help me what I'm doing wrong here.
  18. I want handle 'FriendMessagesClient.NotifyAckMessageEcho#1' message, it's possible?
  19. I am trying to only get defined number of keys in a trade, but instead it adds all the items as they share the same id (item is a TF2 Mann co. key) here is my current code for the trade offer, (the steam id in create offer is a mates steamid as I can't test with my own account due to vac) function buy(steamID, amount){ if(isNaN(amount) || amount === undefined){ client.chatMessage(steamID, "Please enter a valid number"); } else{ var count = 0; var i = 0; client.chatMessage(steamID, "Creating Offer, please wait!"); //Check Players inventory for the keys, and make sure we have enough sets to supply var offer = manager.createOffer('76561198008100070'); offer.setMessage("Price: " + amount + " Keys. Sets: " + amount * config.buyRate); offer.getPartnerInventoryContents(440, 2, function(err, inventory, currencies){ if(err){ console.log(err); } /*for (var j = 0; j < amount; ++j){ if(inventory[i].market_hash_name == config.keysAccepted){ ++count; console.log("Adding Item"); offer.addTheirItem({id: inventory[i].id, appid: 440, contextid: 2}); } }*/ inventory.forEach(function(val){ if(val.market_hash_name == config.keysAccepted){ console.log("Adding Item"); offer.addTheirItem({id: val.instanceid, appid: 440, contextid: 2}); ++count; } }); if(count < amount){ console.log("count: "+count); client.chatMessage(steamID, "You don't have enough keys for me to send this trade."); } else{ offer.send(function(err, status){ if(err){ console.log(err); client.chatMessage(steamID, "An Error has Occured while sending offer."); } if(status == "pending"){ client.chatMessage(steamID, "Confirming Offer!"); } if(status == "sent"){ client.chatMessage(steamID, "Offer Sent!"); } }); } }); } }
  20. Hello, I'd like to ask if there is something like getGameBadgeLevel, but for another user.
  21. 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); })}
  22. i am trying to get the current xp of a user and the xp required to achieve a level but i don't know how to see how much xp they currently have? is there something built into steam-user or should i use another module? here is my code for the command function level(steamID, level){ client.getSteamLevels([steamID], function(results){ console.log("level: " + results[steamID] + "xp: " + results[steamID].xp); // just gives me undefined for the result for xp if(level === undefined){ level = results[steamID]; } if(level >= results[steamID]){ client.chatMessage(steamID, "You would need " + /*xp required here*/ + "more xp for level " + level); } else{ client.chatMessage(steamID, "Please enter a higher number"); } });}
  23. I am trying to get the tf2 quantities, but how am I supposed to get it. I saw on the post that you need an item tag, but how do I get it?\ LINK: https://dev.doctormckay.com/topic/1863-how-do-i-identify-tf2-qualities/
  24. how can i send a message to group using gid or url?
  25. How to fix it i try all webLogOn script but dont working ı use this commands; const async = require('async'); const TradeOfferManager = require('steam-tradeoffer-manager');var manager = null; const SteamCommunity = require('steamcommunity');var community = null;const WebAPI = require('@doctormckay/steam-webapi');var api = null;const SteamID = require('steamid'); const steam = require('./steam');const users = require('./users');const files = require('./files'); var first = true;var ongoing = false; exports.setup = (client, cookies, callback) => {manager = new TradeOfferManager({steam: client,domain: "example.net"});community = new SteamCommunity(); manager.setCookies(cookies);community.setCookies(cookies);api = new WebAPI(files.getConfig().apikey);if(first) {callback();first = false;}registerEvents(); community.on("sessionExpired",function(err) {client.webLogOn();});
×
×
  • Create New...