Jump to content
McKay Development

TextDynasty

Member
  • Posts

    144
  • Joined

  • Last visited

Everything posted by TextDynasty

  1. It fixed thanks. But when i run the code it just go this error Code function sendrec(steamID, amount) { if (!amount) { var amount = 1; } manager.getUserInventoryContents(steamID, 440, 2, true, function (err, inventory){ if (err) { console.log(err); } else { var scrap = inventory.filter(function (item) { return item.name == "Scrap Metal" }); var NeededS = amount * 3 var left = NeededS - amount if (scrap.length === 0){ client.chatMessage(steamID, "It seems you don't have enough scrap."); return true; } else if (amount > NeededS) { client.chatMessage(steamID, "You don't have enough scrap. You'll need " + left + " more scrap metals."); return true; } else if (amount <= NeededS) { manager.getInventoryContents(440, 2, true, function (err, inventory){ if (err) { console.log(err); } else { var pool = inventory.filter(function (item) { return item.name == "Reclaimed Metal" }); // Let the user know we don't have any if (pool.length === 0) { client.chatMessage(steamID, "I don't have available. Sorry!"); return true; } else if (amount > pool.length) { console.log("User asked for more than my backpack."); client.chatMessage(steamID, "I only have " + pool.length + " available. Sorry!"); return true; } else if (amount <= pool.length) { // Start a new trade offer var trade = manager.createOffer(steamID); var token = manager.getOffer; // Add what we should to the current trade console.log("Adding " + amount + " rec."); for (let i = 0; i < amount; i++) { trade.addMyItem(pool[i]); } for (let i = 0; i < NeededS; i++) { trade.addTheirItem(scrap[i]); } // Send the offer off to Steam with a cute message trade.setMessage("Here is your " + amount + " reclaimed metals"); trade.send(function(err, status) { if (err) { console.log(err); return; } if (status == 'pending') { console.log("Offer " + trade.id + "have been sent."); community.startConfirmationChecker(15 * 1000, config.identity); client.chatMessage(steamID, "Processing."); client.chatMessage(steamID, "Offer Sent!! Check your trade offer by here https://steamcommunity.com/tradeoffer/" + trade.id + "/."); } }); } } }); } } })} ERROR node_modules\steam-tradeoffer-manager\lib\classes\TradeOffer.js:254 if (typeof details.appid === 'undefined' || typeof details.contextid === 'undefined' || (typeof details.assetid === 'undefined' && typeof details.id === 'undefined')) { ^ TypeError: Cannot read property 'appid' of undefined
  2. One more question. How to get the offerid? Got this error Offer Sent!! Check your trade offer by clicking here https://steamcommunity.com/tradeoffer/undefined . Feel free to contact my owner. //it should be the id instead of undefined there. var token = manager.getOffer; // Add what we should to the current trade console.log("Adding " + amount + " rec."); for (let i = 0; i < amount; i++) { trade.addMyItem(pool[i]); } // Send the offer off to Steam with a cute message trade.send(); community.startConfirmationChecker(15 * 1000, config.identity); client.chatMessage(steamID, "Offer Sent!! Check your trade offer by clicking here https://steamcommunity.com/tradeoffer/" + token.id + ". Feel free to contact my owner.");
  3. node_modules\steam-tradeoffer-manager\lib\classes\TradeOffer.js:173 items.forEach(function(item) { ^ TypeError: items.forEach is not a function Got that error. My code manager.getInventoryContents(440, 2, true, function (err, inventory){ if (err) { console.log(err); } else { // Filter out all the crates var pool = inventory.filter(function (item) { return item.name == "Reclaimed Metal" }); // Let the user know we don't have any if (pool.length === 0) { client.chatMessage(steamID, 'I don\'t have available. Sorry!'); return true; // Give up } // Let the user know we don't have enough else if (amount > pool.length) { console.log('User requested '+amount+' of I only have '+pool.length+' available.'); client.chatMessage(steamID, 'I only have '+pool.length+' crates of series available. Sending a trade offer with all crates of this series.'); } // Start a new trade offer var trade = manager.createOffer(steamID); // Add what we should to the current trade console.log('Adding '+ amount +' rec '); for (let i = 0; i < amount; i++) { trade.addMyItems(pool[i]); } // Send the offer off to Steam with a cute message trade.send(); } });
  4. How to delete crates automatically with the tf2 package
  5. https://firepowered.org/developer/create-a-steam-trade-bot-with-nodejs-iojs-updated-for-node-steam-v1-0/
  6. The Error said: TimeoutOverflowWarning: 1512342843522 does not fit into a 32-bit signed integer. Timeout duration was set to 1. And what do you mean by timer of 2^31? It works fine on my local computer, but in the cloud server this just happen when i sent the bot offer
  7. Need some help to solve the problem. The bot run fine in local but it cannot read any modules in the cloud server (heroku)
  8. Anyone tell me what can i do with the backpack.tf listing api? Is there anyway to accept the trade offer with correct listing in bp.tf
  9. Is that possible to make the bot crosscheck the listing price of the bp.tf website?
  10. I don't think that is just Steam issue. The onlyRKeys works perfectly, but the onlyGKeys always pop up that message even the amount is correct
  11. manager.on("newOffer", function(offer) { console.log("Incoming offer from " + offer.partner.toString()); //Declining all Trade Holds offer.getUserDetails(function(err, me, them) { if (them) { if (them.escrowDays > 0) { offer.decline(); console.log("They have trade holds. Declining."); client.chatMessage(admin, "User sent a offer with trade hold. Declined.") client.addFriend(user); setTimeout(function() {client.chatMessage(user, "Sorry. We don't accept offer with trade hold.")}, 10000); }} }); var Rkey = 0 var Gkey = 0 var Gmetal = 0 var Rmetal = 0 var user = offer.partner.getSteam3RenderedID() var admin = "76561198302774490" offer.itemsToReceive.forEach(function(item) { if (item.name == "Mann Co. Supply Crate Key"){ return Rkey++ } else if (item.name == "Refined Metal"){ return Rmetal += 9 } else if (item.name == "Reclaimed Metal"){ return Rmetal += 3 } else if (item.name == "Scrap Metal"){ return Rmetal++ }} ); offer.itemsToGive.forEach(function(item) { if (item.name == "Mann Co. Supply Crate Key"){ return Gkey++ } else if (item.name == "Refined Metal"){ return Gmetal += 9 } else if (item.name == "Reclaimed Metal"){ return Gmetal += 3 } else if (item.name == "Scrap Metal"){ return Gmetal++ } }); var onlyGKeys = (offer.itemsToGive.every(function(item) { return item.name == "Mann Co. Supply Crate Key"; })); var onlyRKeys = (offer.itemsToReceive.every(function(item) { return item.name == "Mann Co. Supply Crate Key"; })); //sell key if (onlyGKeys) { if (Rmetal === Gkey * sellkeyprice) { offer.accept(function(err) { if (err) console.log(err); else console.log("Sold " + Gkey + " Keys."); console.log("Amount Correct! Accepting the trade offer."); if (Gkey > 0) { client.chatMessage(admin, "Sold " + Gkey + " Mann Co. Supply Keys."); } setTimeout(function() {client.chatMessage(user, "Thanks for using. http://steamcommunity.com/id/111111111")}, 5000); }); } else { offer.decline(function(err) { if (err) console.log(err); else console.log("Trade offer not validated. Declining"); client.chatMessage(admin, "They are buying it for " + Rmetal + " Scrap Metal."); client.addFriend(user); setTimeout(function() {client.chatMessage(user, "Your offer is incorrect. Please check it again or resent it later.")}, 10000); }); }} //buy key if (onlyRKeys) { if (Gmetal === Rkey * buykeyprice) { offer.accept(function(err) { if (err) console.log(err); else console.log("Bought " + Rkey + " Keys."); console.log("Amount Correct! Accepting the trade offer."); if (Rkey > 0) { client.chatMessage(admin, "Bought " + Rkey + " Mann Co. Supply Keys."); } setTimeout(function() {client.chatMessage(user, "Thanks for using. http://steamcommunity.com/id/11111111")}, 5000); }); } else { offer.decline(function(err) { if (err) console.log(err); else console.log("Trade offer not validated. Declining"); client.chatMessage(admin, "They are selling it for " + Gmetal + " Scrap Metal."); client.addFriend(user); setTimeout(function() {client.chatMessage(user, "Your offer is incorrect. Please check it again or resent it later.")}, 15000); }); }} //other offers will be declined else { offer.decline(function(err) { if (err) console.log(err); else console.log("Trade offer not validated. Declining"); client.chatMessage(admin, "User provided a wrong offer. Declined."); client.addFriend(user); setTimeout(function() {client.chatMessage(user, "Your offer is incorrect. Please check it again or resent it later.")}, 15000); }); }}); Error: Trade offer not validated. Declining { Error: There was an error accepting this trade offer. Please try again later. (11) at Object.exports.makeAnError (C:\Users\Admin\Desktop\Ashley\node_modules\steam-tradeoffer-manager\lib\helpers.js:17:12) at SteamCommunity.manager._community.httpRequestPost (C:\Users\Admin\Desktop\Ashley\node_modules\steam-tradeoffer-manager\lib\classes\TradeOffer.js:485:13) at Request._callback (C:\Users\Admin\Desktop\Ashley\node_modules\steamcommunity\components\http.js:67:15) at Request.self.callback (C:\Users\Admin\Desktop\Ashley\node_modules\request\request.js:186:22) at emitTwo (events.js:106:13) at Request.emit (events.js:191:7) at Request.<anonymous> (C:\Users\Admin\Desktop\Ashley\node_modules\request\request.js:1163:10) at emitOne (events.js:96:13) at Request.emit (events.js:188:7) at IncomingMessage.<anonymous> (C:\Users\Admin\Desktop\Ashley\node_modules\request\request.js:1085:12) eresult: 11 } Amount Correct! Accepting the trade offer. Anyone can help?
  12. Is there any ways to run the bot 24/7 without VPS or opening the local computer 24/7?
  13. Is there a way to autobump the listing in bp.tf in the node? If so, any advices?
  14. How to relaunch the tf2 after a while so that it can load. if (message == "scrap") {{ if (refCount > 1) { let refinedToSmelt = refCount; console.log("Smelting Refined Metals".green); if (refinedToSmelt > usableRefineds.length) { console.log(("We should have %d refineds to balance the reclaimeds, but we " + ((usableRefineds.length > 0) ? ("only have " + usableRefineds.length + ".") : "have none. Skipping.") + (config.get("avoidMetalInActiveTradeOffers") ? " Maybe some metal are in trade offers?" : "")).magenta, refinedToSmelt); refinedToSmelt = usableRefineds.length; } for (let i = 0; i < refinedToSmelt; i++) { metalCrafter.smeltRefined(usableRefineds[i].id); }} if (recCount > 1) { let reclaimedToSmelt = recCount; console.log("Smelting Reclaimed Metals".green); if (reclaimedToSmelt > usableReclaimeds.length) { console.log(("We should have %d reclaimeds to balance the scraps, but we " + (usableReclaimeds.length > 0) ? ("only have " + usableReclaimeds.length) : "have none. Skipping.").magenta, reclaimedToSmelt); reclaimedToSmelt = usableReclaimeds.length; } for (let i = 0; i < reclaimedToSmelt; i++) { metalCrafter.smeltReclaimed(usableReclaimeds[i].id); }} // If we haven't smelt anything, yet we should have, let it continue as we probably will smelt refined. client.setPersona(0); client.gamesPlayed(440); // it instantly reopened tf2 and not showing the metals }}
  15. How to renew to backpack after craft. Because i need to reopen the bot to see the crafted metals.
  16. I am don't understand how it works Can you make me a template? So that I can learn how to do that?
  17. I wanted to build a bot with a function that can automatically detect metal and smelt them to make the trade easiler
×
×
  • Create New...