2can Posted April 30, 2020 Report Posted April 30, 2020 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> Quote
2can Posted May 1, 2020 Author Report Posted May 1, 2020 what does that mean? and how should i fix it? Quote
Emily Posted May 1, 2020 Report Posted May 1, 2020 No. var ourItems = offer.itemsToGive; vrtgn 1 Quote
Heateen Posted May 1, 2020 Report Posted May 1, 2020 (edited) The user deleted this message on request! Edited November 5, 2020 by Heateen vrtgn 1 Quote
2can Posted May 2, 2020 Author Report Posted May 2, 2020 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 Quote
Heateen Posted May 2, 2020 Report Posted May 2, 2020 (edited) The user deleted this message on request! Edited November 5, 2020 by Heateen vrtgn 1 Quote
2can Posted May 2, 2020 Author Report Posted May 2, 2020 im still getting the same error. would you like me to post all of my code? Quote
Heateen Posted May 2, 2020 Report Posted May 2, 2020 (edited) The user deleted this message on request! Edited November 5, 2020 by Heateen Quote
2can Posted May 3, 2020 Author Report Posted May 3, 2020 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(); }); Quote
xLeeJYx Posted May 3, 2020 Report Posted May 3, 2020 (edited) @2can your newOffer event should be processOffer(offer) Its better off you coding it yourself since you can learn your mistake and improve. Not by copying blindly from others and not knowing what is it doing Edited May 3, 2020 by xLeeJYx quote is too long vrtgn 1 Quote
Heateen Posted May 3, 2020 Report Posted May 3, 2020 manager.on('newOffer', (offer) => { processOffer(offer); }); now it should work properly 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.