-
Posts
46 -
Joined
-
Last visited
Everything posted by SunriseM
-
Possible to add getInventoryContents into function?
SunriseM replied to TomYoki's topic in node-steamcommunity
Show the code where you call that function. Are you using multiple accounts? because that is the only reason i see to add manager as parameter in the function. -
If you set a password, it will be encrypted so you will have to disable it first
-
Read both documentations and see what's different. Then just create it again, but using the correct methods and functions. It will depend of how big its your code.
-
What error appears in the console? Running 10 accounts on 1 IP is not a good idea btw.
-
Yes i know that you didn't put that there for some reason. But what if we check only for status code === 401?
-
Question Cant accept incoming offers
SunriseM replied to Mr Game and Watch's topic in node-steam-tradeoffer-manager
Here some help. recived[i].accept(function(err, status) { //Accept the offer and wait for callback err or status if (err) { console.log(err.message); } else { if(status === "pending"){ //Offer needs confirmation. use acceptConfirmationForObject() . recived[i].id is the id that you need to accept } else { //Offer doesn't needs confirmation. console.log("Hooray. Trade Offer Accepted"); } } }); -
I tested with this code: self.community.on('sessionExpired', (err) => { log.info("Session Expired"); }); setTimeout(function(){ log.info("Killing Cookies"); self.community.setCookies(["steamLogin=1||invalid", "steamLoginSecure=1||invalid"]); }, 31000); setTimeout(function(){ log.info("Fixing Cookies"); self.client.webLogOn(); },60000); setInterval(function(){ self.community.getNotifications(function(err, notifications){ if(err) log.error(err); else log.info(notifications); }); }, 15000); After the Killing Cookies part. getNotifications returns HTTP Error 401 (Not authorized), after the Fixing Cookies part i get the notifications without errors. Then i checked the source code and found out that you only emit "sessionExpired" when HTTP Error is from 300 to 399. When its 401 it just callbacks the error. if (response.statusCode >= 300 && response.statusCode <= 399 && response.headers.location.indexOf('/login') != -1) { err = new Error("Not Logged In"); callback(err, response, body); this._notifySessionExpired(err); return err; } Edit: i found this part too. but for some reason im not getting the sessionExpired event. if (typeof html === 'string' && html.match(/g_steamID = false;/) && html.match(/<h1>Sign In<\/h1>/)) { err = new Error("Not Logged In"); callback(err); this._notifySessionExpired(err); return err; } Edit 2: Modified this part and it worked, but i suppose it needs more changes. if (response.statusCode >= 400) { err = new Error("HTTP error " + response.statusCode); err.code = response.statusCode; callback(err, response, body); this._notifySessionExpired(err); // <----- return err; }
-
Question Cant accept incoming offers
SunriseM replied to Mr Game and Watch's topic in node-steam-tradeoffer-manager
I see that you are not confirming the offer. Are you using Steam-Community startConfirmationChecker method? -
Read numbers and/or words from Chat Messages?
SunriseM replied to TomYoki's topic in node-steamcommunity
You can use "split" to convert the string to array and get the part you want. Example: client.on('friendOrChatMessage', (senderID, message) => { //Example Message: /bet 45 var arrmsg = message.split(" ") //arrmsg = ["/bet","45"] var userNumber = arrmsg[1] if (message.indexOf("/bet") == 0){ client.chatMessage(senderID, 'Your bet is: ' + userNumber); } }); -
Yes its in the community module. What do you have exactly inside of community.on('sessionExpired', (err) => { });
-
You can use "split" to convert the string to array and get the part you want. Example: client.on('friendOrChatMessage', (senderID, message) => { //Example Message: /bet 45 var arrmsg = message.split(" ") //arrmsg = ["/bet","45"] var userNumber = arrmsg[1] if (message.indexOf("/bet") == 0){ client.chatMessage(senderID, 'Your bet is: ' + userNumber); } }); You will have to add other things like be sure that input has /bet [number], verify the number can be used, etc
-
User "for" to loop all your inventory, check if the name is the one you want, if it does, get its assetid and send a normal offer with it, its not that hard. If your code doesn't work put it here and i will tell you whats wrong with it.
-
technically you can do it. You have to iterate trough your inventory and search for the item with the name you want, get the assetid and then send the offer. you might need to fetch other data like quality, if the item is craftable, unusual effect if its unusual, etc to be sure is the item you want.
-
Is it possible to get item description from trade offer?
SunriseM replied to TomYoki's topic in node-steam-tradeoffer-manager
Because match is used in Strings and items.descriptions is an array. You can use find(). function matchDescription(description) { return description === 'my description match'; } (this is the 388th line) if (item.appid == "my app ID" && item.type.match("My match")) { if(item.descriptions.find(matchDescription)){ return } ) -
An error occurred while getting user profile
SunriseM replied to solomad's topic in node-steamcommunity
USER variable is undefined. Confirm is the correct name and write your code please -
get assetIDs by calling getInventoryContents?
SunriseM replied to TomYoki's topic in node-steam-tradeoffer-manager
You should use a loop (for, foreach, while, etc) to iterate all the inventory callback, you can create an array called items, and in each iteration you push a object like this one: var item = { "assetid": inventory[i].id, "name": inventory[i].market_hash_name } if you need to make an asynchronous operation with that info and know when all iterations are finished, you can use async module. -
Hello, i want to implement proxies in my bot so i can be a little more safe about hitting the api request limit. I found out that you have to use the same ip for all request once you login, so should i relogin and use a different ip everytime i want to load the inventory or should i i do it when i detected the response is null? Is there a better way of doing it? Thank you.
-
Hello. I have been trying to load my bot inventory, but it have been too slow, first i though it was my internet because its very bad but then i tried to test using the request module and it got the inventory in 1 second. I have tried loading my tf2 inventory too and it worked fine. These are the codes i used to test it: Testing the manager.getUserInventoryContents: console.time("Load Inventory"); setTimeout(function(){ log.warn("Timeout") }, 60000); manager.getUserInventoryContents("76561198355595262", 753, 6, true, function(err, inventory){ if(err) log.error(err); else { console.timeEnd("Load Inventory") } }) Output: Timeout. Inventory never loaded and this is the code with request: var url = "http://steamcommunity.com/inventory/76561198355595262/753/6?l=english"; console.time("Load Inventory") request(url, function(err, response, body){ if(!err && response.statusCode === 200){ console.log(body) console.timeEnd("Load Inventory") } }); Output: inventory and 1017ms Am i doing something wrong?