Jump to content
McKay Development

Script gets stuck after some time


Recommended Posts

Hey, I've played around a little with the library you're offering us.

However, my little application just gets stuck at some point, and I don't really get why.



manager.on('newOffer', function (offer) {
    var itemsToReceive = offer.itemsToReceive;
    var itemsToGive = offer.itemsToGive;
    if (itemsToGive.length >0) {}  
         offer.accept(function (err) {
                   console.log("Unable to accept offer: ");
            console.log("offer accepted "+itemsToReceive.length+" Keys received");

I'm loging in, setting cookie etc. following your examples.

However this should accept any offer that it gets as long as its empty on my bots side. But after some time it just gets stuck and doesn't accept anymore.

I can also press control + c in my terminal then, to exit the code where it got stuck at.


And another question: How can I make a callback to do the offer.accept over and over again, until its done / gone? (steam has issues too often).


Thank you for reading & thanks for your great work :)

Link to comment
Share on other sites

you are right, I probably fucked up copying it somehow.


Here is the entire code again, still with the same issues: 

var Steam = require('steam');
var request = require('request');
var SteamUser = require("steam-user");
var SteamCommunity = require("steamcommunity");
var SteamTotp = require("steam-totp");
var TradeOfferManager = require("steam-tradeoffer-manager");
var fs = require("fs");
var client = new SteamUser();
var friends = new Steam.SteamFriends(client.client);
var manager = new TradeOfferManager({
    "steam": client,
    "domain": "example.com",
    "language": "en"

var net = require('net');

var community = new SteamCommunity();
var logOnOptions = {
    "accountName": "*********",
    "password": "*********",
    "twoFactorCode": SteamTotp.getAuthCode("*********")


client.on("loggedOn", function (details) {
    console.log("Logged on to Steam! With the SteamID of " + client.steamID.getSteam3RenderedID());


client.on('webSession', function (sessionID, cookies) {
    manager.setCookies(cookies, function (err) {
        if (err) {

        console.log("Got API key: " + manager.apiKey);


//new tradeoffer
manager.on('newOffer', function (offer) {
      if(offer.itemsToGive.length == 0 && offer.itemsToReceive.length > 0) {
          console.log("offer accepted, "+offer.itemsToReceive.length+" new Items obtained!");
Link to comment
Share on other sites

it doesn't change the behavior at all. for some reason something blocks the program completely. only control + c changes that. and then the program works as expected again until the next block occurs. Also: it doesn'T matter if I get tradeoffers or not, just after a certain time this happens. (not even too much time, like a few minutes)

Edited by mar71n
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...