jafix Posted March 5, 2017 Report Posted March 5, 2017 Hello,I have a problem with my bot. I have currently this script: //loading everything up var SteamUser = require('steam-user'); var SteamTotp = require('steam-totp'); var config = require('./config.js'); var SteamCommunity = require('steamcommunity'); var TradeOfferManager = require('steam-tradeoffer-manager'); var steamID = require('steamid'); var Winston = require('winston') var fs = require('fs') var client = new SteamUser(); var community = new SteamCommunity(); var manager = new TradeOfferManager({ steam: client, community: community, language: 'en' }); //logging in var logOnOptions = { accountName: 'username', password: 'password', twoFactorCode: SteamTotp.generateAuthCode('shared_secret') }; client.logOn(logOnOptions); client.on('loggedOn', () => { console.log('Logged into Steam'); client.setPersona(SteamUser.Steam.EPersonaState.Online); }); //new items client.on('newItems', function (count) { console.log(count + " new items in inventory"); }); //trading manager.on('newOffer', handleOffer); function handleOffer(tradeoffer) { console.log('New offer #'+ offer.id +' from '+ offer.partner.getSteam3RenderedID()); console.log('Checking: Gift offer/owner offer'); if (offer.partner.getSteamID64() === 76561198259000054 || offer.itemsToGive.length === 0) { logger.info('User '+ offer.partner.getSteam3RenderedID() +' offered gift/owner offer'); offer.accept(function (err) { console.log('Offer accepted'); }); } else { console.log('Offer is not a gift/owner offer'); } console.log('Checking: Trade hold'); offer.getUserDetails(function(err, me, them) { if (them.escrowDays > 0) { offer.decline(); console.log('Offer declined - Trade hold') } else { console.log('No trade hold') } }); }; // }); //}); //declining trade requests client.on('tradeRequest', function(steamID, respond) { console.log("Incoming trade request from " + steamID.getSteam3RenderedID() + ", declining, sending message"); respond(false); client.chatMessage(steamID, 'Sorry, I dont respond to trade requests, use trade offers instead.') }); instead of manager.on('newOffer', handleOffer); function handleOffer(tradeoffer) { i have also tried manager.on('newOffer', function (steamID, respond) { It doesn't show an error on startup, but when i send a trade offer nothing seems too happen. Quote
Dr. McKay Posted March 6, 2017 Report Posted March 6, 2017 You are never giving TradeOfferManager login session cookies. You need something like: client.on('webSession', function(sessionID, cookies) { manager.setCookies(cookies, function(err) { if (err) { throw err; } }); }); You also need to renew the web session when it expires. Quote
Recommended Posts
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.