Jump to content
McKay Development

TextDynasty

Member
  • Posts

    144
  • Joined

  • Last visited

Everything posted by TextDynasty

  1. Hi, I would like to ask if there's any free hosting site for trading bots? I found some hosting site but I don't know how to use them correctly and most of them are just trail.
  2. Thanks for your help in my other question. I think this is what you want, getting the type of the metals and accept the offer right? This is my script and I hope it can help a little bit. //Price of items //They are all in scrap //Calculate it in : https://calculator.tf/ //sell order var sellkeyprice = 249 var buykeyprice = 248 manager.on("newOffer", function(offer) { console.log(colors.bgBlue(timestamp("[hh:mm:ss] Incoming offer from " + offer.partner.toString()))); var Rkey = 0 var Gkey = 0 var Gmetal = 0 var Rmetal = 0 var user = offer.partner.getSteam3RenderedID() offer.itemsToReceive.forEach(function(item) { if (item.name == "Mann Co. Supply Crate Key"){ return Rkey++ } else if (item.name == "Tour of Duty Ticket"){ return RToD++ } 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 == "Tour of Duty Ticket"){ return GToD++ } 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++ } }); //sell key if (Gkey > 0) { currency = Rmetal - Gmetal if (currency === Gkey * sellkeyprice + GToD * selltodprice) { offer.accept(function(err) { if (err) console.log(err); else console.log(colors.bgGreen(timestamp("[hh:mm:ss] Sold " + Gkey + " Keys and " + GToD + " Tour of Duty Tickets."))); console.log(colors.bgGreen(timestamp("[hh:mm:ss] Amount Correct! Accepting the trade offer."))); if (Gkey > 0) { client.chatMessage(admin, "Sold " + Gkey + " Mann Co. Supply Keys."); } else { client.chatMessage(admin, "Sold " + GToD + " Tour Of Duty Tickets."); } setTimeout(function() {client.chatMessage(user, "Thanks for using AshleyBot. http://steamcommunity.com/id/AshleyBot")}, 5000); }); } else { offer.decline(function(err) { if (err) console.log(err); else console.log(colors.bgRed(timestamp("[hh:mm:ss] Trade offer not validated. Declining"))); client.chatMessage(admin, "They are buying it for " + currency + " Refined Metal."); client.addFriend(user); setTimeout(function() {client.chatMessage(user, "Your offer is incorrect. Please check it again or resent it later.")}, 10000); }); }} //buy key else if (Rkey > 0) { currency = Gmetal - Rmetal if (currency === Rkey * buykeyprice + RToD * buytodprice) { offer.accept(function(err) { if (err) console.log(err); else console.log(colors.bgGreen(timestamp("[hh:mm:ss] Bought " + Rkey + " Keys and " + RToD + " Tour of Duty Tickets."))); console.log("Amount Correct! Accepting the trade offer."); if (Rkey > 0) { client.chatMessage(admin, "Bought " + Rkey + " Mann Co. Supply Keys."); } else { client.chatMessage(admin, "Bought " + RToD + " Tour Of Duty Tickets."); } setTimeout(function() {client.chatMessage(user, "Thanks for using AshleyBot. http://steamcommunity.com/id/AshleyBot")}, 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 " + currency + " Refined 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(colors.bgRed(timestamp("[hh:mm:ss] 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); }); }}); And also one more question if you can help me a bit. I don't know how to craft any metal by the bot
  3. The assetID works fine but it didn't smelt any metal. Maybe we need a recipe or something? Or my crafting script placed in the wrong place?
  4. tf2.craft[rec[0].id]; This doesn't work too...
  5. Do you mean by this? if (scrap.length < 3) { console.log("Crafting more scrap..."); tf2.craft[rec[0].id]; console.log("Done."); }This doesn't work too
  6. Do you mean by replacing the [rec[0].id] by the reclaimed metal asset ID itself? if (scrap.length < 3) { console.log("Crafting more scrap..."); tf2.craft([5345296927]); // The assetID? or what should i put in an array console.log("Done."); } Or this? if (scrap.length < 3) { console.log("Crafting more scrap..."); tf2.craft(rec[0].assetid); console.log("Done."); }
  7. But it didn't work also. The console said i am connected TF2 GC, but it didn't craft anythings
  8. Do you mean by this? var Winston = require('winston'); // For logging var SteamUser = require('steam-user'); // The heart of the bot. We'll write the soul ourselves. var TradeOfferManager = require('steam-tradeoffer-manager'); // Only required if you're using trade offers var config2 = require('./config2.js'); var fs = require('fs'); // For writing a dope-ass file for TradeOfferManager var SteamTotp = require('steam-totp') var Steamcommunity = require('steamcommunity'); var Steam = require('steam'); var colors = require('colors'); var TeamFortress2 = require('tf2'); var Language = require('./language.js'); var timestamp = require('console-timestamp'); var TeamFortress2 = require('tf2'); var handlers = TeamFortress2.prototype._handlers; var client = new SteamUser(); var tf2 = new TeamFortress2(client); //So i created tf2 here? client.on('loggedOn', function (details) { console.log(timestamp("[hh:mm:ss] Logged into Steam as " + config2.username.green)); client.gamesPlayed([440]); //Connected to TF2 GC? }); if (scrap.length < 3) { console.log("Crafting more scrap..."); tf2.craft(rec[0].id); console.log("Done."); } But it didn't work also
  9. client.on('loggedOn', function (details) { console.log(timestamp("[hh:mm:ss] Logged into Steam as " + config2.username.green)); client.gamesPlayed([440]); //Connected to TF2 GC? }) if (haveGCSession = true) { var tf2 = new TeamFortress2(user); if (scrap.length < 3) { console.log("Crafting more scrap..."); tf2.craft(rec[0].id); console.log("Done."); }} else { console.log("We didn't connected to TF2 GC") }
  10. Thanks for the answer. The errors are gone, but it didn't craft any metal out... var tf2 = new TeamFortress2(user); if (scrap.length < 3) { user.gamesPlayed([440]); console.log("Crafting more scrap...") tf2.craft(rec[0].id); console.log("Done.") }
  11. Hi. I used the node tf2 for crafting metal, but i found out some problems in my coding that it didn't work. manager.loadInventory(440, 2, true, function(err, inventory) { if (err) { console.log(err); return; } if (inventory.length == 0) { // Inventory empty console.log("TF2 inventory is empty"); return; } console.log(colors.bold.green.bgYellow("Backpack has " + inventory.length + " items")); var key = inventory.filter(function (item) { return item.name == 'Mann Co. Supply Crate Key' }); var ref = inventory.filter(function (item) { return item.name == 'Refined Metal' }); var rec = inventory.filter(function (item) { return item.name == 'Reclaimed Metal' }); var scrap = inventory.filter(function (item) { return item.name == 'Scrap Metal' }); var tf2 = new TeamFortress2(user); if (scrap.length < 3) { console.log("Crafting more scrap...") tf2.craft(rec) //craft a reclaimed metal when there are not enough scrap } }); Error: node_modules\bytebuffer\dist\ByteBufferNB.js:1067 throw TypeError("Illegal value: "+value+" (not an integer or Long)"); ^ TypeError: Illegal value: [object Object] (not an integer or Long) at TypeError (native)
  12. Thanks for answering. But i got this after i changed to this coding var logger = new (Winston.Logger)({ transports: [ new (Winston.transports.Console)({ colorize: true, level: 'debug' }), new (Winston.transports.File)({ level: 'info', timestamp: true, filename: 'cratedump.log', json: false }) ] }); if(fs.existsSync(POLLDATA_FILENAME)) { try { manager.pollData = JSON.parse(fs.readFileSync(POLLDATA_FILENAME)); } catch(e) { logger.verbose("polldata.json is corrupt"); } } manager.on('pollData', function(pollData) { fs.writeFile(POLLDATA_FILENAME, JSON.stringify(pollData)); }); Error verbose: polldata.json is corrupt Welcome back my master. Found previous trade offer poll data. Importing it to keep things running smoothly. undefined:1 SyntaxError: Unexpected end of input at Object.parse (native) at C:\Users\kingwang\Desktop\Trade Offer Bot\bot2.js:93:32 at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3) Press any key to continue . . .
  13. Hi. I got a problem like this and i don't know how to fix it. log.verbose("polldata.json is corrupt"); ^ ReferenceError: log is not defined at Object.<anonymous> (C:\Users\kingwang\Desktop\Trade Offer Bot\bot2.js:55:3) at Module._compile (module.js:409:26) at Object.Module._extensions..js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Function.Module.runMain (module.js:441:10) at startup (node.js:139:18) at node.js:974:3 And here is my code if(fs.existsSync(POLLDATA_FILENAME)) { try { manager.pollData = JSON.parse(fs.readFileSync(POLLDATA_FILENAME)); } catch(e) { log.verbose("polldata.json is corrupt"); } } manager.on('pollData', function(pollData) { fs.writeFile(POLLDATA_FILENAME, JSON.stringify(pollData)); }); var logger = new (Winston.Logger)({ transports: [ new (Winston.transports.Console)({ colorize: true, level: 'debug' }), new (Winston.transports.File)({ level: 'info', timestamp: true, filename: 'cratedump.log', json: false }) ] }); var client = new SteamUser(); var offers = new TradeOfferManager({ steam: client, domain: config2.domain, language: "en", pollInterval: 10000, cancelTime: 50000 }); fs.readFile('polldata.json', function (err, data) { if (err) { logger.warn('Error reading polldata.json. If this is the first run, this is expected behavior: '+err); } else { console.log('Welcome back my master.'.green); console.log("Found previous trade offer poll data. Importing it to keep things running smoothly.".info); offers.pollData = JSON.parse(data); } }); client.logOn({ accountName: config2.username, password: config2.password, }); client.on('loggedOn', function (details) { console.log(timestamp("[hh:mm:ss] Logged into Steam as " + config2.username.green)); // If you wanted to go in-game after logging in (for crafting or whatever), you can do the following client.gamesPlayed(440); }); client.on('webSession', function (sessionID, cookies) { console.log("Got web session".info); client.setPersona(1) offers.setCookies(cookies, function (err){ if (err) { logger.error('Unable to set trade offer cookies: '+err); process.exit(1); } logger.info("Trade offer cookies set."); manager.loadInventory(440, 2, true, function(err, inventory) { if (err) { console.log(err); return; } if (inventory.length == 0) { // Inventory empty console.log("TF2 inventory is empty"); return; } console.log("Found " + inventory.length + " TF2 items"); var ref = inventory.filter(function (item) { return item.name == 'Refined Metal' }); var rec = inventory.filter(function (item) { return item.name == 'Reclaimed Metal' }); var scrap = inventory.filter(function (item) { return item.name == 'Scrap Metal' }); console.log("Found " + ref.length + " Refined Metal"); console.log("Found " + rec.length + " Reclaimed Metal"); console.log("Found " + scrap.length + " Scrap Metal"); var inventory = inventory.filter(function (item) { return item.name == 'Refined Metal' }); var trade = offers.createOffer(admin); trade.addMyItems(inventory); trade.setMessage("Here, have some items!"); trade.send(function(err, status) { if (err) { console.log(err); } else { console.log("Success. Offer was sent to admin.") } }); }); }); }); Any ideas how to fix this problem? Also, my bot is working fine before
  14. Is there any ways to get two factor code by typing in command and how to set up stock command in steam chat?
  15. i want using to code to craft metal, so what should i call it? 'craft'?
  16. Hi there. I found a code from gihub and idk if it is working... because it doesnt do anything. user.on('inventory', function (backpack, craft, err) { var inventory = backpackLoaded var random_refined = getRandomRefinedID(inventory); tf2.craftItems([random_refined]); // will smelt first refined found in the inventory setTimeout(function() { steamTrade.loadInventory(440, 2, function(inventory1) { // reload inventory console.log("loaded new inventory 1"); if (JSON.stringify(inventory1) !== JSON.stringify(inventory)) { // if inventory has changed console.log("got the new backpack!"); var random_reclaimed = getReclaimedIDs(inventory1, inventory); //get the id of a reclaimed smelted before tf2.craftItems([random_reclaimed]); // smelt it to a scrap setTimeout(function() { steamTrade.loadInventory(440, 2, function(inventory2) { // reload inventory console.log("loaded new inventory 2"); if (JSON.stringify(inventory2) !== JSON.stringify(inventory1)) { // if inventory has changed console.log("Yes, new backpack!"); inventory = inventory2; } else { console.log("oh no , still the old one"); } }); }, 10000); } else { console.log("still as the old one :("); } }); }, 10000); })
  17. Is there any way to identify chat message? Like if people say hi to you and you will say hi or hello?
  18. Are you using node to login? If yes, i hope it would help var client = new SteamUser(); client.logOn({ accountName: config.username, //type your username password: config.password, //type your password "twoFactorCode": SteamTotp.getAuthCode("shared_secret") //type your shared secret });
  19. Array is like this? { "appid": 440, "contextid": 2, "amount": 1, "assetid": "1627590398" } But i tried that, he said i "appid" is need to follow by ")". i don't know what to do
  20. sorry, I thought it was an example... but i don't really understand about the backpack.... sorry about i may be annoying... I have tried my best client.on('crafting', function(err, craftItems) { craftItems(440, 2, 5193739645) //can we skip the recipe part and get assetid from backpack directly replace the code? console.log("Crafted Metals") });
  21. Hi. I've got some ideas about setting up some quota to some items, so that i won't overstock. Is there something I need to do with backpack or only the offer manager?
  22. I've seen you example but i still don't understand what to do with the recipe because it doesn't do anything to my metal handlers[Language.CraftResponse] = function(body) { var blueprint = body.readInt16(); // recipe ID?? var unknown = body.readUint32(); var idCount = body.readUint16(); var idList = [440, 2, 5193739645]; // 5193739645 is my assetid for(var i = 0; i < idCount; i++) { var id = body.readUint64().toString(); idList.push(id); // item id } this.emit('craftingComplete', blueprint, idList); };
×
×
  • Create New...