Jump to content
McKay Development

2can

Member
  • Posts

    5
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

2can's Achievements

  1. const TradeOfferManager = require('steam-tradeoffer-manager'); const SteamCommunity = require('steamcommunity'); const SteamUser = require('steam-user'); const SteamTotp = require('steam-totp'); const Prices = require('./prices.json'); const config = require('./config.json'); const client = new SteamUser(); const community = new SteamCommunity(); const manager = new TradeOfferManager({ steam: client, community: community, language: 'en' }); const logOnOptions = { accountName: config.username, password: config.password, twoFactorCode:SteamTotp.generateAuthCode(config.sharedSecret) }; client.logOn(logOnOptions); client.on('loggedOn', () => { console.log('Succesfully logged on.'); client.setPersona(SteamUser.EPersonaState.Online, 'BOT'); client.gamesPlayed(440); }); client.on('friendRelationship', (steamid, relationship) => { if (relationship === 2) { client.addFriend(steamid); client.chatMessage(steamid, 'Hello there! Thanks for adding me!'); console.log("Added a friend") } }); client.on('webSession', (sessionid, cookies) => { manager.setCookies(cookies); community.setCookies(cookies); community.startConfirmationChecker(20000, config.identitySecret); }); function acceptOffer(offer) { offer.accept((err) => { community.checkConfirmations(); console.log("We Accepted an offer"); if (err) console.log("There was an error accepting the offer."); }); } function declineOffer(offer) { offer.decline((err) => { console.log("We Declined an offer"); if (err) console.log("There was an error declining the offer."); }); } function processOffer(offer) { if (offer.isGlitched() || offer.state === 11) { console.log("Offer Declined!"); declineOffer(offer); } else if (offer.partner.getSteamID64() === config.ownerID) { acceptOffer(offer); } else { var ourItems = offer.itemsToGive; var theirItems = offer.itemsToReceive; var ourValue = 0; var theirValue = 0; for (var i in ourItems) { var item = ourItems[i].market_name; if(Prices[item]) { ourValue += Prices[item].sell; } else { console.log("Invalid value."); ourValue += 99999; } } for(var i in theirItems) { var item= theirItems[i].market_name; if(Prices[item]) { theirValue += Prices[item].buy; } else { } } } if (ourValue <= theirValue) { acceptOffer(offer); } else { declineOffer(offer); } } client.setOption("promptSteamGuardCode", false); manager.on('newOffer', offer => { processOffer(); });
  2. i did that and now im getting this in console. C:\Users\serbe\Downloads\bot\bot.js:70 if (offer.isGlitched() || offer.state === 11) { ^ TypeError: Cannot read property 'isGlitched' of undefined at processOffer (C:\Users\serbe\Downloads\bot\bot.js:70:15) at TradeOfferManager.<anonymous> (C:\Users\serbe\Downloads\bot\bot.js:108:3) at TradeOfferManager.emit (events.js:311:20) at C:\Users\serbe\Downloads\bot\node_modules\steam-tradeoffer-manager\lib\polling.js:239:10 at Array.forEach (<anonymous>) at C:\Users\serbe\Downloads\bot\node_modules\steam-tradeoffer-manager\lib\polling.js:223:12 at C:\Users\serbe\Downloads\bot\node_modules\steam-tradeoffer-manager\lib\index.js:509:4 at C:\Users\serbe\Downloads\bot\node_modules\steam-tradeoffer-manager\lib\assets.js:171:4 at C:\Users\serbe\Downloads\bot\node_modules\async\dist\async.js:1140:9 at C:\Users\serbe\Downloads\bot\node_modules\async\dist\async.js:473:16
  3. C:\Users\serbe\Downloads\bot\bot.js:79 var our_items = offer.itemsToGive; ^ TypeError: Cannot read property 'itemsToGive' of undefined at process (C:\Users\serbe\Downloads\bot\bot.js:79:27) at TradeOfferManager.<anonymous> (C:\Users\serbe\Downloads\bot\bot.js:134:3) at TradeOfferManager.emit (events.js:311:20) at C:\Users\serbe\Downloads\bot\node_modules\steam-tradeoffer-manager\lib\polling.js:239:10 at Array.forEach (<anonymous>) at C:\Users\serbe\Downloads\bot\node_modules\steam-tradeoffer-manager\lib\polling.js:223:12 at C:\Users\serbe\Downloads\bot\node_modules\steam-tradeoffer-manager\lib\index.js:509:4 at C:\Users\serbe\Downloads\bot\node_modules\steam-tradeoffer-manager\lib\assets.js:171:4 at C:\Users\serbe\Downloads\bot\node_modules\async\dist\async.js:1140:9 at C:\Users\serbe\Downloads\bot\node_modules\async\dist\async.js:473:16 C:\Users\serbe\Downloads\bot>
×
×
  • Create New...