Jump to content
McKay Development

If I am using this, I still need node-steamcommunity?


KaMilml

Recommended Posts

I am working in a steam trade bot just for send offers, not anymore. And have to use node-steamcommunity because I need necessarily the startConfirmationChecker metod.


But I want to use just this module node-steam-user because the maker says this is a improve... the problem is exists the startConfirmationChecker metod in this module? :(


Link to comment
Share on other sites

The different modules are good at different things. steam-user only handles communication with the Steam CM servers. Confirmations don't go through those servers, so you need steamcommunity for that. In my opinion, you should use steam-user, steamcommunity, and steam-tradeoffer-manager for the most robust system.

Link to comment
Share on other sites

I still have another question about it. This is my code:

const startBot = bot => {
  community[bot] = new SteamCommunity()
  tradeManager[bot] = new TradeOfferManager(config.tradeConfig)
  tradeManager[bot].community  = community[bot]
  fs.readFile('polldata_'+bot+'.json', (err, data) => { err ? console.log('no habia polldata') : tradeManager[bot].pollData = JSON.parse(data) })
  community[bot].login({ accountName: config[bot].accountName, password: config[bot].password, twoFactorCode : SteamTotp.getAuthCode(config[bot].sharedSecret) }, (err, sessionID, cookies) => {
    if (!!err) throw console.log('fallo el login:', err)
    tradeManager[bot].setCookies(cookies, err => { err ? process.exit() : console.log('cookies '+bot+':', tradeManager[bot].apiKey) })
    community[bot].startConfirmationChecker(3600000, config[bot].identitySecret)
  })
  community[bot].on('confKeyNeeded', (tag, callback) => callback(null, time, SteamTotp.getConfirmationKey(config[bot].identitySecret, Math.floor(Date.now() / 1000), tag)))
  community[bot].on('confirmationAccepted', confirmation => {
    io.to(offers[confirmation.offerID].socketID).emit('offerResponse', { code: 'confirmationAccepted', offerID: confirmation.offerID })
    console.log('confirmationAccepted', confirmation)/*; socketResponse('confirmationAccepted', confirmation.offerID)*/
  })
  community[bot].on('newConfirmation', confirmation => { console.log('newConfirmation', confirmation) })
  tradeManager[bot].on('sentOfferCanceled', (offer, reason) => socketResponse('sentOfferCanceled', offer.id))
  tradeManager[bot].on('sentPendingOfferCanceled', offer => socketResponse('sentPendingOfferCanceled', offer.id))
  tradeManager[bot].on('pollData', pollData => fs.writeFileSync('polldata_'+bot+'.json', JSON.stringify(pollData)))
  tradeManager[bot].on('pollFailure', err => console.log('error steam API', err))
  tradeManager[bot].on('newOffer', offer => { offer.decline(); console.log('se nos envio una nueva oferta', offer.id) })
  tradeManager[bot].on('unknownOfferSent', offer => { offer.decline(); console.log('se envio oferta sin el manager', offer.id) })
  tradeManager[bot].on('realTimeTradeConfirmationRequired', offer => { offer.decline(); console.log('se envio oferta desde el cliente steam') })
  tradeManager[bot].on('realTimeTradeCompleted', offer => console.log('se completo oferta desde el cliente steam'))
  tradeManager[bot].on('receivedOfferChanged', (offer, oldState) => console.log('receivedOfferChanged', offer.id, TradeOfferManager.ETradeOfferState[oldState], '=>', TradeOfferManager.ETradeOfferState[offer.state]))
  tradeManager[bot].on('sentOfferChanged', (offer, oldState) => {
    console.log(offer.state)
    if (offer.state == '3') socketResponse('Accepted', offer.id)
    if (offer.state == '11') socketResponse('InEscrow', offer.id)
    if (offer.state == '7') socketResponse('Declined', offer.id)
    if (offer.state == '4') socketResponse('Countered', offer.id)
    if (offer.state == '8') socketResponse('InvalidItems', offer.id)
  })
} 

Then my question is, if my app is just using node-steamcommunity and steam-tradeoffer-manager for what would I need node-steam-user?

Or just doing this:

tradeManager[bot] = new TradeOfferManager(config.tradeConfig)
tradeManager[bot].steam = new SteamUser()
tradeManager[bot].community = new SteamCommunity()

My app will be better?


I am sorry for many question, I just want to understand what exactly is necessary and why. Thank you =)

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.

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