Jump to content
McKay Development

Recommended Posts

Posted

I see this error by the first time, steamcommunity display error.message:  Not Logged In, when I try to get page with my trade offers.
I don't know why it's happen but after about an hour this error disappears. And one more notice, bot can accept offers but can't send it (error 503 as Not Loged in).

Posted (edited)

I am already logged in this function only starts when bot is logged in.

Sorry if I waste your time, but this error exist only with one of my bots, another works perfect.

 

Part of my code when sending offer:

 

Bot.prototype.CreateOffer = function(partner, items, token, callback){
    var self = this;
    var items = items;
    self.LoadInventory(function(err, inventory){
        if(err){
            self.SteamLoginRepeat(err);
            callback(true, null);
            return;
        }
        var inventory = inventory;
        var itemsToSend = [];
        self.steam.httpRequest("http://steamcommunity.com/my/tradeoffers/sent/",{}, function(err, response, body){
            if(err){
                self.log("error", "Error httpRequest: " + err.message); // err.message here == Not logged in
                self.SteamLoginRepeat(err); // this function relogin bot with steamcommunity.oauth or if error on oauth with steamcommunity.login
                callback(true, null);
                return;
            }
            if(response.statusCode != 200) return;
            body = new HtmlDom(body);
            body.$('.inactive').remove();
            body = body.html();
            for(var index in items) {
                for(var i in inventory) {
                    var thisItem = inventory[i];
                    if(thisItem.classid == items[index].classid && body.indexOf(thisItem.assetid) == -1){
                        var push = {
                            "assetid": thisItem.assetid,
                            "appid": thisItem.appid,
                            "contextid": thisItem.contextid,
                            "amount": 1
                        };
                        itemsToSend.push(push);
                        delete inventory[i];
                        break;
                    }
                }
            }
            if(itemsToSend.length <= 0){
                self.log("error", "Nothing to send!");
                callback(true, null);
                return;
            }
            var newOffer = self.manager.createOffer(partner);
            newOffer.addMyItems(itemsToSend);
            newOffer.send("" , token, function(err){
                if(err){
                    self.SteamLoginRepeat(err.message);// if no errors above, here appear error: HTTP Error 403
                    callback(true, null);
                    return;
                }
                callback(false, newOffer);
            });
        });
    });
};
Edited by Dr. McKay
Code tags

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.

Guest
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.

Loading...
×
×
  • Create New...