Jump to content
McKay Development

Recommended Posts

Posted

Sup guys. I've been getting this error every once in a while when trying to confirm a trade:

```

14|trade   | Error: Could not act on confirmation
14|trade   |     at /root/tradingbot/node_modules/steamcommunity/components/confirmations.js:145:12
14|trade   |     at SteamCommunity.<anonymous> (/root/tradingbot/node_modules/steamcommunity/components/confirmations.js:276:3)
14|trade   |     at Request._callback (/root/tradingbot/node_modules/steamcommunity/components/http.js:67:15)
14|trade   |     at Request.self.callback (/root/tradingbot/node_modules/request/request.js:186:22)
14|trade   |     at emitTwo (events.js:125:13)
14|trade   |     at Request.emit (events.js:213:7)
14|trade   |     at Request.<anonymous> (/root/tradingbot/node_modules/request/request.js:1163:10)
14|trade   |     at emitOne (events.js:115:13)
14|trade   |     at Request.emit (events.js:210:7)
14|trade   |     at IncomingMessage.<anonymous> (/root/tradingbot/node_modules/request/request.js:1085:12)
```

Here is my code (it's monstrously horrendous. Ive cut too many corners to neaten it):

```js

  acceptOffer(offer) {
    return new Promise((resolve, reject) => {
      offer.accept((err, status) => {
        if (err) {
          if (err.message == 'Not Logged In') {
            this.once('managerCookies', () => {
              this.acceptOffer(offer)
            })
            return
          }
          return reject(err)
        }
        this.manager.once('receivedOfferChanged', (offer, oldState) => {
          if (offer.state == 3) {
            this.pushBullet.note('Trade Offer Accepted:', `Giving: \n${offer.itemsToGive.map(item => item.market_hash_name).join('\n')} \nReceiving: \n${offer.itemsToReceive.map(item => item.market_hash_name).join('\n')}`)
            offer.getReceivedItems((err, items) => {
              this.emit('debug', 'Accepted trade offer')
              this.emit('debug', 'Updating inventory cache')
              this.backpack.loadBptfInventory()
                .then(() => {
                  this.emit('debug', 'Loaded BPTF inventory')
                  for (let item of items) {
                    if (this.prices[item.market_hash_name]) {
                      if (!this.prices[item.market_hash_name].isCurrency) {
                        this.emit('debug', 'Attempting to list the item')
                        this.backpack.createSellListing(item.id, this.backpack.scrapToRef(this.prices[item.market_hash_name].sell))
                          .then(res => {
                            if (res.listings[item.id].created == 1) {
                              this.emit('debug', 'Created Listing')
                            } else {
                              this.emit('debug', 'Error creating listing')
                            }
                          })
                          .catch(err => {
                            this.emit('debug', err)
                          })
                      }
                    }
                  }
                })
                .catch(err => {
                  this.emit('debug', 'Error loading my bptf Inventory...')
                  this.emit('debug', err)
                })
              //should do error handling here.
            })
            return resolve(true)
          }
        })
        this.community.acceptConfirmationForObject(this.logOnOptions.identitySecret, offer.id, err => {
          if (err) {
            return reject(err)
          }
        })
      })
    })
  }

```

 

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