Jump to content
McKay Development

chnel

Member
  • Posts

    9
  • Joined

  • Last visited

chnel's Achievements

  1. Hi, i've been trying to send trade offers in loop every time it blows. Here is what im doing in theory: im reading some valuables from local text file such as my items assetid, tradelinks and market hash name of item that i want to add trade. then im creating offers in loop and sending them. i tried to sleep in loop and so many things every time it gives error. in code : var SteamUser = require('steam-user'); var SteamCommunity = require('steamcommunity'); var SteamTotp = require('steam-totp'); var TradeOfferManager = require('steam-tradeoffer-manager'); var fs = require('fs'); var client = new SteamUser(); var manager = new TradeOfferManager({ "steam": client, "domain": "google.com","language": "en" }); var community = new SteamCommunity(); // Steam logon options var logOnOptions = { "accountName": "***", "password": "****", "twoFactorCode": SteamTotp.getAuthCode("sharedSecret")}; var lineReader = require('readline').createInterface({ input: require('fs').createReadStream('trd.txt')}); var lines=[]; var i,text,q; var itmName,myitmid; i = 0; q=0; // so far so good lineReader.on('line', function (line) {lines[i]=line;console.log(i+". trd :"+lines[i]);i++;}); lineReader2 = require('readline').createInterface({ input: require('fs').createReadStream('nm.txt')}); lineReader2.on('line',function (line2){ itmName =line2; console.log("itmName :"+itmName);}); lineReader3 = require('readline').createInterface({ input: require('fs').createReadStream('myitm.txt')}); lineReader3.on('line',function (line3){ myitmid =line3;console.log("myitmid :"+myitmid);}); //end reading if (fs.existsSync('polldata.json')) { manager.pollData = JSON.parse(fs.readFileSync('polldata.json'));} client.logOn(logOnOptions); client.on('loggedOn', function() { console.log("Logged into Steam");}); client.on('webSession', function(sessionID, cookies) //right here it begins { for(q = 0; q<lines.length-1;q++)//creating loop { manager.setCookies(cookies, function(err) { console.log("//////////"); console.log("q : "+q); console.log(lines[q]); console.log("\\\\\\\\\\"); //used this because it reads all links but tries to send just lastone if (err){console.log(err);process.exit(1);return;} var linqs = getstID(lines[q]);//getting the userid from tradelink cItmId = getInv(linqs);//getting asset id of item if(cItmId !== false && cItmId !== "undefined")//checking the value before send offer { sndTrade(myitmid,cItmId,lines[q]); } else { console.log("false"); } }); community.setCookies(cookies); } }); manager.on('sentOfferChanged', function(offer, oldState){console.log(`Offer #${offer.id} changed: ${TradeOfferManager.ETradeOfferState[oldState]} -> ${TradeOfferManager.ETradeOfferState[offer.state]}`);}); manager.on('pollData', function(pollData){fs.writeFile('polldata.json', JSON.stringify(pollData));}); function getstID(st)//that function gets the userid from tradelink { var ll = st.substring(st.indexOf("=")+1,st.indexOf("&")); ll = "[U:1:"+ll+"]"; return ll; } function getInv(sTeamID)//that func returns the assetid { manager.loadUserInventory(sTeamID,730,2,false,function(err,inventory) { console.log("envanter yükleniyor"); if(err) { console.log("[WARNING]: Couldn't load inventory of " + sTeamID + "!"); } else { console.log(sTeamID+"envanteri yüklendi"); for (var p = 0;p<inventory.length;p++) { if(inventory[p].market_hash_name == itmName) { console.log("item bulundu"); return inventory[p].assetid; } else { console.log(sTeamID+"Item bulunamadı"); return false; } } } }) } function sndTrade(mnItm,cItm,trdLink)//that creates the offer. { var offer = manager.createOffer(trdLink); offer.addMyItem({"assetid":mnItm,"appid":730,"contextid":2}); offer.addTheirItem({"assetid":cItm,"appid":730,"contextid":2}); offer.send(function(err,status) { if (err) {console.log(err);return;} if (status == "pending"){console.log("offer #${offer.id} sent, but reqires confirmation.");} }); } i've tried without/with functions, tried to log every value to check up.
  2. Hi there, i've been doing some tries as hobby and i wanted to share with you. I believe it will be usefull. before read or copying the code just consider some valuable; ♦manager is a call from TradeOfferManager, so you will need to replace atleast tags. var manager = new TradeOfferManager({"steam":client,"domain":"google.com","language":"en"}); function getInv(sTeamID,itmName){ manager.loadUserInventory(sTeamID,730,2,false,function(err,inventory) { if(err) { console.log("[WARNING]: Couldn't load inventory of " + sTeamID + "!"); } else { console.log(sTeamID+"inventory loaded"); for (var p = 0;p<inventory.length;p++) { if(inventory[p].market_hash_name == itmName) { return inventory[p].assetid; } else { console.log(sTeamID+"item could not found"); return false; } } } })}How to use : explanation of valuables; sTeamID : is the steamid of the person who own's that inventory. itmName : is the item that you want to get assetid you need to set here market_hash_name. Example using : var hisItem = getInv("[U:1:00000000]","P2000 | Fire Elemental (Factory New)"); That will return to you asset id with that you can easily send trade offers. Also you can combine with https://dev.doctormckay.com/topic/643-function-that-sends-offer-basic/ this to send trade easy as well. Note : that function have been written for CSGO if you want to use this for other apps just edit the appid with yours or you could add a valuable to function and send it while calling the function.
  3. Hi there, i've been doing some tries as hobby and i wanted to share with you. I believe it will be usefull. before read or copying the code just consider some valuable; ♦offer is a call from TradeOfferManager, so you will need to replace atleast tags. var manager = new TradeOfferManager({"steam":client,"domain":"google.com","language":"en"}); ♦client is a call of SteamUser. var client = new SteamUser(); function sndTrade(mnItm,cItm,trdLink) { manager.setCookies(cookies, function(err) { if (err){console.log(err);process.exit(1);return;} var offer = manager.createOffer(trdLink); offer.addMyItem({"assetid":mnItm,"appid":730,"contextid":2}); offer.addTheirItem({"assetid":cItm,"appid":730,"contextid":2}); offer.send(function(err,status) { if (err) {console.log(err);return;} if (status == "pending"){console.log("offer #${offer.id} sent, but reqires confirmation.");} }); community.setCookies(cookies); }); } How to use : explanation of valuables; mnItm : is your item's assetid that you want to add to trade. cItm : is the assetid of you want to get. trdLink: is the trade link of the person you want to trade. Example using : sndTrade("0000000","1111111",https://steamcommunity.com/tradeoffer/new/?partner=0000000&token=1111111)To easily get assetid of the other user's item you can use https://dev.doctormckay.com/topic/644-function-that-returns-the-assetid-of-specific-item-basic/ as well. Note : that function have been written for CSGO if you want to use this for other apps just edit the appid with yours or you could add a valuable to function and send it while calling the function.
  4. manager.loadUserInventory("steam64id", 730, 2, false, function (err, inventory) { if (err) { console.log(warning("[WARNING]: Couldn't load inventory of " + user + "!")); } else { for (var p = 0; p< inventory.length; p++) { if (inventory[p].name == "skinname") { console.log(inventory[p].assetid); } } } }); here is how its solved if anyone needs. set the steam id and skin name it will write down the asset id.
  5. Yes it absolutely is, but what i tried to ask was not how to add an item by assetid. It was how to find it.
  6. Well, thanks your time again but i could not figured out how to get assetid of item i want.
  7. hi, im getting not logged in error and i could not find why here is my code : var SteamUser = require("steam-user"); var client = new SteamUser; var TradeOfferManager = require('steam-tradeoffer-manager'); var manager = new TradeOfferManager({ steam: client, domain: "localhost", language: "en", pollInterval: 10000, cancelTime: 300000 }); client.logOn({ "accountName":"steamid", "password":"steampw", }); client.on('loggedOn', function(details){ console.log("["+client.steamID.getSteam3RenderedID()+"]Logged on"); client.setPersona(SteamUser.EPersonaState.Online); client.gamesPlayed(440); }); client.on('error',function(e){console.log(e)}); client.on('webSession',function(sessionID,cookies){console.log("++WebSession++")}); client.on('newItems',function(count){console.console.log(count+" yeni eÅŸya.");}) client.on('accountLimitations', function(limited, communityBanned, locked, canInviteFriends) { var limitations = []; if(limited) { limitations.push('LIMITED'); } if(communityBanned) { limitations.push('COMMUNITY BANNED'); } if(locked) { limitations.push('LOCKED'); } if(limitations.length === 0) { console.log("Our account has no limitations."); } else { console.log("Our account is " + limitations.join(', ') + "."); } if(canInviteFriends) { console.log("Our account can invite friends."); } }); var offer = manager.createOffer("https://steamcommunity.com/tradeoffer/new/?partner=11111&token=22222") offer.addMyItems([ { "appid": 730, "contextid": 2, "assetid": "7883664867" } ]); offer.addTheirItems([ { "appid": 730, "contextid": 2, "assetid": "7679971620" } ]); offer.send(function(err, status) { if (err) { throw err; } console.log("Offer #" + offer.id + " is now " + status); });
  8. Hi there, i've been trying to do a bot as hobby. All the think i've been trying to is send a tradeoffer to my other account for spesific item. I've done it with the item id, which i get it by html code from chrome. What i want to do is get that item id and send the offer. Ex : i've a deagle sunset ww and i want to sent offer to myaccount2 this item for usp-s orion mw.
×
×
  • Create New...