Jump to content
McKay Development

Search the Community

Showing results for tags 'node-steam-tradeoffer-manager'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • News & Announcements
    • Releases & Updates
  • Help & Support
    • General
    • Guides
    • node-steam-user
    • node-steamcommunity
    • node-steam-tradeoffer-manager
    • node-steam-session

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Skype


Location


Interests

  1. Hello guys, Can we re-check offer after error? manager.on('sentOfferChanged', function(offer, oldState) { if(offer) { console.log('Offer #' + offer.id + ' | oldState: ' + oldState + ' | newState: ' + offer.state); if(offer.isOurOffer && offer.itemsToReceive.length > 0) { if(oldState == 2 && offer.state == 3) { var receivedItems = []; offer.getReceivedItems(true, function(err, items) { if(err) { //RE-CHECK OFFER throw err; return; } // MY CODE } } } } );
  2. Hi guys! I have a question. My bot every time when doing trade offer poll execute 3-10 offer polls for every offer, is it ok? Because i think it should execute only one request. Doing trade offer poll since 1511880049 Doing trade offer poll since 1511880049 Doing trade offer poll since 1 (full update) Doing trade offer poll since 1511880049 Here's my tradeoffermanager init: var manager = new TradeOfferManager({ "steam": client, "domain": "hidden", "language": "ru", "cancelTime": 3600000 });
  3. Hey At the beginning it was working fine, but now it won't accept incoming offer from my main. This is the code:https://pastebin.com/zkQbFSGG how to auto cancel an offer after a moment? Thanks in advance !!!
  4. Hello, Can we reload/recall LoadInventory on error? manager.loadInventory(AppID, ContextID, true, function(err, inv, curr) { if(err) { //Reload here console.log("error while loading inv"); return; } //code });Thanks
  5. The bot sometimes does not inform back on a tradeoffer state change, this can be very annoying, is there any way to prevent this?
  6. Hey, I wanted to modify checkAvailableKey() (https://pastebin.com/nYYQGEHE) so when someone write !trade in chat i get this error (https://imgur.com/a/BNbLr) . this is the new code:https://pastebin.com/dE534e9L Thanks in advance !!! <script> </script>
  7. Hello, recently i use "getReceivedItems" to get the new assetids from new items in my inventory and save them in my database. Withdraws of the same items to users are very easy in that way (have not to search them in my inventory by name, ...) Most of the time when steam runs in good state i have no problems with that. But sometimes especially on the weekend some outgoing offers fail with state "InvalidItems" or error 26 on retry. Some items (not every from that invaliditems trade) arent anymore with that assetid from my database in my inventory. It looks like they have changed the id. Do you know that problem? is there a way to find out the new assetids without searching them by name in my inventory? My problem with searching by name is (for the repair of the ids), if there is much action on my bot it could happen that a search by name choose very new accepted items (before getReceivedItems write the assetids to my database -> using my database as blacklist which item ids are "free" in my inventory (to find for that missing ids the "new" id...
  8. Is that possible to make the bot crosscheck the listing price of the bp.tf website?
  9. Hello. Please tell me, how can I use multiple accounts? client1.logOn(logOnOptions1); client2.logOn(logOnOptions2); client3.logOn(logOnOptions3); Or is there a more correct way? And I think Steam has limits on requests, so me need to use several IP addresses? Help please, maybe someone had an experience.
  10. Hello, I have problem getting new assetid's after trade. Sometimes steam is just giving bad new assetid. I tryed offer.getReceivedItems() and offer.getExchangeDetails(). For example: - offer.getReceivedItems() - https://pastebin.com/9BHN8zQK - offer.getExchangeDetails() - https://pastebin.com/B83595WH but new item have completely different assetid: https://pastebin.com/xKT0pQmr Steam is still showing wrong assetid it only happens with first item of trade rest have good id's. There is a solution to fix this, because this bug is annoying?
  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. Hello, I'm writing very rarely in the forum, I usually solve problems, but this one exceeded me There was a problem getting new identifiers from the accepted offer. (offer.getReceivedItems()). The problem is very rare and again retrieving IDs does not help. There are 21 items available. Only one item has invalid identifiers, and owner value is "0" instead of openID account. Link to account on which are the items from the offer:https://steamcommunity.com/profiles/76561198361335405/inventory/json/730/2 Link to the JSON file with the content of the offer:https://pastebin.com/06HRjeSU Please press Ctrl + F and search "id" : "12569687364". This item has returned an invalid identifier and the value "owner". The correct ID is 12702283129. classid and instance id is valid. The remaining 20 items are correct.
  13. This is what I'm talking about: https://github.com/DoctorMcKay/node-steam-tradeoffer-manager/wiki/TradeOfferManager#constructoroptions Unlike the steam property it isn't said what it's for. What I expect it to do is use its request thing, but I'm not too sure
  14. How to renew to backpack after craft. Because i need to reopen the bot to see the crafted metals.
  15. I woke up this morning and I realized that a guy named "You offered sorry, i am poor" with an private backpack sent my bot offer and eventually taking all my refined metal from my backpack. I made the bot myself and I don't really know what could it be apart from hacking or whatever? That guy steam acc: http://steamcommunity.com/profiles/76561197966699544 Here's my code 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 config1 = require('./config1.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 handlers = TeamFortress2.prototype._handlers; var client = new SteamUser(); var user = new SteamUser(); var admin = config1.admin //Price of items //They are all in scrap //Calculate it in : https://calculator.tf/ //show price var showsellkeyprice = 34 var showbuykeyprice = 33.88 var showselltodprice = 13.66 var showbuytodprice = 13.55 //sell order var sellkeyprice = Math.round(showsellkeyprice * 9) var selltodprice = Math.round(showselltodprice * 9) //buy order var buykeyprice = Math.round(showbuykeyprice * 9) var buytodprice = Math.round(showbuytodprice * 9) var manager = new TradeOfferManager({ "steam": client, "domain": "example.com", "language": "en" }); colors.setTheme({ silly: 'rainbow', input: 'grey', verbose: 'cyan', prompt: 'grey', info: 'cyan', data: 'grey', help: 'cyan', warn: 'yellow', debug: 'blue', error: 'red' }); var community = new Steamcommunity(); const POLLDATA_FILENAME = 'polldata.json'; var appid = { TF2: 440, }; var contextid = { TF2: 2, } 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: config1.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: config1.username, password: config1.password, "twoFactorCode": SteamTotp.getAuthCode("YpZO9e5\/s9gzgCidJ9G+xt0sh4=") }); client.on('loggedOn', function (details) { console.log(timestamp("[hh:mm:ss] Logged into Steam as " + config1.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."); console.log(colors.bold.bgGreen("Currently Price: ")) console.log(colors.bold.green.bgYellow("Buy : Key " + showbuykeyprice + " Refined Metal.")); console.log(colors.bold.green.bgYellow(" ToD " + showbuytodprice + " Refined Metal.")); console.log(colors.bold.cyan.bgYellow("Sell: Key " + showsellkeyprice + " Refined Metal.")); console.log(colors.bold.cyan.bgYellow(" ToD " + showselltodprice + " Refined Metal.")); }); }); //Chat Command client.on('friendMessage', function(steamID, message) { if (steamID == config1.admin) { console.log("Friend message from admin: " + message); } else { console.log("Friend message from " + steamID+ ": " + message); } if (message == "hi") { client.chatMessage(steamID, "Hi. This is Ashley. How can I help?"); } else if (message == "price") { client.chatMessage(steamID, "Current Price:"); client.chatMessage(steamID, "Buy : Key " + showbuykeyprice + " Refined Metal."); client.chatMessage(steamID, " ToD " + showbuytodprice + " Refined Metal."); client.chatMessage(steamID, "Sell: Key " + showsellkeyprice + " Refined Metal."); client.chatMessage(steamID, " ToD " + showselltodprice + " Refined Metal."); } else if (message == "help") { client.chatMessage(steamID, "Available commands: help, price, owner"); } else if (message == "owner") { client.chatMessage(steamID, "This bot is working for http://steamcommunity.com/profiles/76561198302774496/. Feel free to add my owner if you have any problems."); } else if (steamID == config1.admin) { if (message == "code") { var code = SteamTotp.getAuthCode("YpZO9e5\/M+9gzgCidJ9G+xt0sh4=") client.chatMessage(steamID, "Here is the code " + code + " ."); }} else { client.chatMessage(steamID, "Hi. You can type in help for more command."); } }); client.on('emailInfo', function (address, validated) { console.log("Our email address is ".info + address.green + " and it's " + (validated ? "validated" : "not validated".info)) }); client.on('wallet', function (hasWallet, currency, balance) { if (hasWallet) { console.log("We have ".info + SteamUser.formatCurrency(balance, currency).green +" Steam wallet credit remaining".info); } else { logger.info("We do not have a Steam wallet."); } }); //Account Limitations client.on('accountLimitations', function (limited, communityBanned, locked, canInviteFriends) { if (limited) { // More info: https://support.steampowered.com/kb_article.php?ref=3330-IAGK-7663 logger.warn("Our account is limited. We cannot send friend invites, use the market, open group chat, or access the web API."); } if (communityBanned){ // More info: https://support.steampowered.com/kb_article.php?ref=4312-UOJL-0835 // http://forums.steampowered.com/forums/showpost.php?p=17054612&postcount=3 logger.warn("Our account is banned from Steam Community"); // I don't know if this alone means you can't trade or not. } if (locked){ // Either self-locked or locked by a Valve employee: http://forums.steampowered.com/forums/showpost.php?p=17054612&postcount=3 logger.error("Our account is locked. We cannot trade/gift/purchase items, play on VAC servers, or access Steam Community. Shutting down."); process.exit(1); } if (!canInviteFriends){ // This could be important if you need to add users. In our case, they add us or just use a direct tradeoffer link. logger.warn("Our account is unable to send friend requests."); } }); //Trade Offer Part //If you want to change the price, go to the top and find var price. //It is just for key trade offer only. manager.on("newOffer", function(offer) { console.log(colors.bgBlue(timestamp("[hh:mm:ss] 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(colors.bgRed(timestamp("[hh:mm:ss] 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 RToD = 0 var GToD = 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 == 1 }} ); 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 == 1 } }); //sell key if (Gkey || GToD > 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 || RToD > 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(colors.bgGreen(timestamp("[hh:mm:ss] 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); }); } //Admin give keys to the bot else if (offer.partner.getSteamID64() == config1.admin){ offer.accept(function (err) { if (err) { console.log(colors.bgGreen(timestamp("Error. Offer not accepted."))); } else { console.log(colors.bgGreen(timestamp("[hh:mm:ss] Recieved " + Rkey + " Keys From Admin."))); } })} 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 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); }); }}); community.on('confKeyNeeded', function(tag, callback) { var time = Math.floor(Date.now() / 1000); callback(null, time, SteamTotp.getConfirmationKey('CbkNXcqKOPv9O6s89jnDWy9pyTc=', time, tag)) console.log(colors.bgGreen(timestamp("[hh:mm:ss] Trade offer accepted."))); }); offers.on('pollData', function (pollData) { fs.writeFile('polldata.json', JSON.stringify(pollData)); }); ////Mobile Confirmation Part client.on('webSession', function(sessionID, cookies) { manager.setCookies(cookies, function(err) { if (err) { console.log(err); process.exit(1); } }); community.setCookies(cookies); community.startConfirmationChecker(15 * 1000, 'CbkNXcqKOPv9O6s89jnDWy9pyTc='); });
  16. Hello guys. I know what is a amount code but I couldn't add in my script. Can you help me ? const SteamUser = require('steam-user'); const TradeOfferManager = require('steam-tradeoffer-manager'); const SteamTotp = require('steam-totp'); const SteamCommunity = require('steamcommunity'); const fs = require('fs'); const request = require('request'); const config = require('./config.json'); const community = new SteamCommunity(); const client = new SteamUser(); const manager = new TradeOfferManager({ steam: client, domain: 'example.com', language: 'en' }); /* Polling Steam and Logging On */ client.logOn({ accountName: config.username, password: config.password, twoFactorCode: SteamTotp.generateAuthCode(config.sharedSecret) }); /* Getting prices */ const priceUrl = 'https://api.steamapi.io/market/prices/' + config.options.appid + '?key=' + config.options.apikey; function getPriceList() { if (!config.options.apikey) { console.log("UNABLE TO GET PRICELIST: steamapi.io API key not given. Please provide API key in config.json"); return process.exit(1); } request(priceUrl, (error, response, body) => { if (error || response.statusCode !== 200) return console.log(`Error: ${error} - Status Code: ${response.statusCode}`); fs.writeFile('prices.json', body); }); } function priceItemsInOffer(offer) { let offerValue = 0; if (offer) { const prices = require('./prices.json'); //Requiring price file //Loop through offer and get total price for (var x in offer) { prices[offer[x].market_hash_name] >= config.options.minPricePerItem ? offerValue += prices[offer[x].market_hash_name] : null; } } return offerValue; } //Make the first price request getPriceList(); //Auto Refresh price setInterval(getPriceList, config.options.priceRefreshInterval * 1000); /* Friend requests and chat */ client.on('friendRelationship', (steamID, relationship) => { if (relationship === 2 && config.options.acceptRandomFriendRequests) { client.addFriend(steamID); client.chatMessage(steamID, config.options.chatResponse.newFriend); } }); client.on('friendMessage', (steamID, message) => { console.log(config.options.chatResponse.commands[message]); if (config.options.chatResponse.commands[message]) { client.chatMessage(steamID, config.options.chatResponse.commands[message]); } else { client.chatMessage(steamID, config.options.chatResponse.unknownCommand); } }); /* Offer handling */ function isInArray(value, array) { return array.indexOf(value) > -1; } function acceptOffer(offer) { offer.accept((err) => { if (err) console.log(`Unable to accept offer: ${err.message}`); community.checkConfirmations(); }); } function declineOffer(offer) { offer.decline((err) => { if (err) return console.log(`Unable to decline offer: ${err.message}`); }); } manager.on('newOffer', function(offer) { const partnerID = offer.partner.getSteamID64(); offer.getUserDetails((err, me, them) => { if(err) return console.log(err); if(them.escrowDays > 0) { console.log('Trade is in escrow. Declining.'); declineOffer(offer); } }); console.log(`New offer # ${offer.id} from ${partnerID}`); if (isInArray(partnerID, config.adminIDs)) { client.chatMessage(partnerID, config.options.chatResponse.adminTrade); acceptOffer(offer); } else if (!offer.itemsToGive.length) { console.log(`${partnerID} just donated us items.`); client.chatMessage(partnerID, config.options.chatResponse.donation); //Sending message for donations acceptOffer(offer); } else if (priceItemsInOffer(offer.itemsToReceive) < config.options.minimumprice) { client.chatMessage(partnerID, config.options.chatResponse.junk); //Sending message for donations declineOffer(offer); } else if (priceItemsInOffer(offer.itemsToGive) > priceItemsInOffer(offer.itemsToReceive) * config.options.percentamount) { client.chatMessage(partnerID, config.options.chatResponse.tradeDeclined); //Sending message when trade declined declineOffer(offer); } else { client.chatMessage(partnerID, config.options.chatResponse.tradeAccepted); //Sending message for accepting offer acceptOffer(offer); } });
  17. Hello. I have a big problem. I bought a new VPS and setup my bot scripts . First time ı start my bot script its good work for 4 hours but now, it dont sending any trade offer. Just write "Proccesing your request.." but dont work anything. Can you help me ? What is this ? (I have tried other accounts)
  18. I wanted to build a bot with a function that can automatically detect metal and smelt them to make the trade easiler
  19. Hi, someone can help me with this problem? When some trade offer that was sent by bot has set to Declined , Expired or Canceled, this is the result: This is the code: manager.on('sentOfferChanged', function(offer, oldState) { console.log(TagGF+'Offer '+offer.id+' changed: '+TradeOfferManager.ETradeOfferState[oldState]+' -> '+TradeOfferManager.ETradeOfferState[offer.state]+''); if(offer.state == TradeOfferManager.ETradeOfferState.Declined || offer.state == TradeOfferManager.ETradeOfferState.Canceled || offer.state == TradeOfferManager.ETradeOfferState.Expired || offer.state == TradeOfferManager.ETradeOfferState.CanceledBySecondFactor || offer.state == TradeOfferManager.ETradeOfferState.Countered) { console.log(TagGF+"Offer '"+offer.id+"' has been '"+TradeOfferManager.ETradeOfferState[offer.state]+"'"); if(offer.state == TradeOfferManager.ETradeOfferState.Countered) { offer.decline(function(err) { if (err) { console.log(TagGF+"Unable to decline offer: " + err.message); } else { console.log(TagGF+"Offer Declined! (Countered Trade!)"); } }); } if(offer.itemsToGive.length > 0) { offer.getExchangeDetails(function(err, status, tradeInitTime, receivedItems, sentItems) { if(err) { console.log(TagGF+"Couldn't get sent items (aD): " + err); } else { var names = sentItems.map(function(item) { return item.name; }); if(sentItems.length > 0) { for(var i = 0; i < sentItems.length; i++) { pool.query("UPDATE gf_user_items SET intrade='0' WHERE assetid='"+sentItems[i].assetid+"'", function(err) { if(err) { console.log(TagGF_Error+"Error Unsetting Item InTrade!"); console.log(TagGF_Error+"Explained Error Message: "+err); return; } }); } } } }); } } else if(offer.state == TradeOfferManager.ETradeOfferState.Accepted) { if(offer.itemsToReceive.length > 0) { //DEPOSIT offer.getReceivedItems(function(err, items) { if (err) { console.log(TagGF+"Couldn't get received items: " + err); } else { var names = items.map(function(item) { return item.name; }); if(items.length > 0) { console.log(TagGF+"Received: " + names.join(', ')); pool.query("SELECT * FROM gf_trades WHERE tradeoffer_id='"+offer.id+"'", function(err, res) { if((err)||(!res[0])) { console.log(TagGF_Error+"Error Finding EID of the User Associated to this Trade Offer ("+offer.id+")"); if(err) console.log(TagGF_Error+"Explained Error Message: "+err); return; } var eid = res[0].user_eid; console.log(TagGF+"Saving Items Info to User EID: "+eid); for(var i = 0; i < items.length; i++) { var price; var itemI = items[i]; var marketName = itemI.market_hash_name; var args = querystring.stringify({name:marketName}); //var options = {host:'csgocf.cf',path:'/_api/GF_GetCachedPrice.php?'+args}; /*var request = http_.request(options, function (res) { var data = ''; var eid = eid; var item = itemI; var mN = marketName; var assetID = item.assetid; var imageURL = item.icon_url; res.on('data', function (chunk) { data += chunk; }); res.on('end', function () { price = data; console.log(TagGF+"The Price of this Skins: "+price); }); }); request.on('error', function (e) { price = "0.00"; console.log(TagGF_Error+"Error Getting the Price of \""+marketName+"\""); console.log(TagGF_Error+"Explained Error: "+e) }); request.end();*/ var item = itemI; var mN = marketName; var assetID = item.assetid; var imageURL = item.icon_url; pool.query("INSERT INTO gf_user_items (user_eid,name,assetid,imageurl,price) VALUES('"+eid+"', '"+mN+"', '"+assetID+"', '"+imageURL+"', '"+price+"')", function(err) { if(err) { console.log(TagGF_Error+"Error Saving Item into User!"); console.log(TagGF_Error+"Explained Error Message: "+err); return; } }); var options = {host:'csgocf.cf',path:'/_api/GF_UpdatePrices.php?c'}; request.get('http://csgocf.cf/_api/GF_UpdatePrices.php?c',options,function(err,res,body){ if(err) { console.log(TagGF+Errpr+"Error Updating Skins Prices on Database!");return; } if(res.statusCode !== 200 ) { console.log(TagGF+Errpr+"Error Updating Skins Prices on Database!");return; } console.log(TagGF+"All Prices Updated!"); }); //DEBUG console.log(items[i]); } console.log(TagGF+"Trade Offer Status Updated! (OfferID:"+offer.id+"|AcceptedStatus:1)"); ToastR_EID("Trade offer accepted. ("+offer.id+")","success",eid); UpdateInventorys(eid); }); } } }); } else if(offer.itemsToGive.length > 0) { //WITHDRAW offer.getExchangeDetails(function(err, status, tradeInitTime, receivedItems, sentItems) { if (err) { console.log(TagGF+"Couldn't get sent items: " + err); } else { var names = sentItems.map(function(item) { return item.name; }); if(sentItems.length > 0) { //console.log(TagGF+"Removing: " + names.join(', ')); pool.query("SELECT * FROM gf_trades WHERE tradeoffer_id='"+offer.id+"'", function(err, res) { if((err)||(!res[0])) { console.log(TagGF_Error+"Error Finding EID of the User Associated to this Trade Offer ("+offer.id+")"); if(err) console.log(TagGF_Error+"Explained Error Message: "+err); return; } var eid = res[0].user_eid; console.log(TagGF+"Removing Items Info to User EID: "+eid); for(var i = 0; i < sentItems.length; i++) { //DEBUG console.log(sentItems[i]); pool.query("DELETE FROM gf_user_items WHERE assetid='"+sentItems[i].assetid+"' AND user_eid='"+eid+"'", function(err) { if(err) { console.log(TagGF_Error+"Error Removing Item into User!"); console.log(TagGF_Error+"Explained Error Message: "+err); return; } }); } pool.query("UPDATE gf_trades SET accepted='1' WHERE tradeoffer_id='"+offer.id+"'", function(err) { if(err) { console.log(TagGF_Error+"Error Updating Trade Offer Status!"); console.log(TagGF_Error+"Explained Error Message: "+err); return; } console.log(TagGF+"Trade Offer Status Updated! (OfferID:"+offer.id+"|AcceptedStatus:1)"); ToastR_EID("Trade offer accepted. ("+offer.id+")","success",eid); UpdateInventorys(eid); }); }); } } }); } } });
  20. I am new here I want to know what security that i should checked before making trade bot. All suggest is welcome. sorry for my bad english. thanks
  21. Hello, Can we pause/resume event sentOfferChanged or check it manually? Thanks for answer
  22. As far as I understand, the assetid, that is needed to identify a specific item, can change after a trade. When sending an offer and the other party accepts it, how can I get the new assetids of the received items, so I can save the ids in my database and use them, later on, to identify the items and send them? Is there a method that I can call on the 'sentOfferChanged' event to get the new assetids? That's all I want to know. Thanks!
  23. HI. This error below is a steam error or in my script? Thanks
×
×
  • Create New...