bulgakovk / steamBot

A simple example of bot which can parse items from incoming offers and send outgoing offer trades confirming it by 2FA code.
14 stars 5 forks source link

Access Denied #16

Closed ghost closed 8 years ago

ghost commented 8 years ago

Hey, i get this error when i try to send trade offer. My code: manager.loadInventory("730", "2", true, function(err,inventory, currencies){ if (err) console.log(err); var Item; inventory.forEach(function(item,i,arr){ if (item.market_hash_name == "Chroma 2 Case") Item = item; }); var offer = manager.createOffer("xxxxxxxx"); //Put here stemdId offer.addMyItem(Item); offer.send("Hello!", function(err,status){ if (err) console.log(err); else console.log(status); }); });

bulgakovk commented 8 years ago

Can you show error log in console? Make screen please.

ghost commented 8 years ago

http://prntscr.com/9hc923

bulgakovk commented 8 years ago

Did you try to write Item in console and check it? I mean are you sure that it's correct?

ghost commented 8 years ago

I think it's because i didn't set accessToken. In other bot (it is not working now because of steam update) i see the code:

                offers.makeOffer ({
                    partnerSteamId: row[i].userid,
                    itemsFromMe: item,
                    accessToken: row[i].token,
                    itemsFromThem: [],
                    message: 'Your winning on site '+sitename+' in game #'+gamenum
                }, function(err, response){
                    if (err) {
                        return;
                    }
                    console.log('Trade offer for queue '+gamenum+' sent!'); 
                });

but i cannot imagine how the code should look in your bot.

Edit: Yes! I found a solution. The code: manager.loadInventory("730", "2", true, function(err,inventory, currencies){ if (err) console.log(err); var Item; inventory.forEach(function(item,i,arr){ if (item.market_hash_name == "Chroma 2 Case") Item = item; }); var offer = manager.createOffer("xxxxxxxx"); //Put here stemdId offer.addMyItem(Item); offer.send("Hello!", "token", function(err,status){ if (err) console.log(err); else console.log(status); }); });