question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

acceptAndParseOffer

See original GitHub issue

Hi, your acceptAndParseOffer don’t work with trades over 40 items (I test on dota 2) please fix it this is my code:

function acceptAndParseOffer(offer, botID) {
    console.log(offer.id);
    offer.getReceivedItems(function (err, items) {
        if (!err) {
            offer.accept(true, function (err, status) {
                if (!err) {
                    var itemsPrice = [];
                    items.forEach(function (item, itemNum) {
                        var itemInfo = {
                            name: item.name,
                            market_hash_name: item.market_hash_name,
                            classid: item.classid,
                            botID: botID
                        };
                        parsePrice(item.market_hash_name, function (price) {
                            console.log(price);
                            itemInfo.price = price;
                            redisClient.rpush('inventory_' + offer.partner.getSteamID64(), JSON.stringify(itemInfo));
                        });
                    });
                    console.tag('Deposits').info('Оффер #' + offer.id + ' успешно принят!');
                    io.sockets.emit('newItemsToInv', offer.partner.getSteamID64());
                }
            });
        } else {
            console.tag('Deposits').error(err,items);
            setTimeout(function () {
                acceptAndParseOffer(offer, botID)
            }, 1000);
        }
    });
}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
DoctorMcKaycommented, Jun 23, 2016

You haven’t received items if you haven’t accepted the trade.

2reactions
scholtzmcommented, Jun 23, 2016
    offer.getReceivedItems(function (err, items) {
        if (!err) {
            offer.accept(true, function (err, status) {

How can you “get received items” before you accept the offer? You haven’t received anything yet.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found