Jump to content


Photo

how can i get how many csgokeys my robot has? like steam wallet?

node.js node-steamcommunity

  • Please log in to reply
4 replies to this topic

#1 venfiw

venfiw

    Member

  • Member
  • PipPip
  • 13 posts

Posted 28 September 2018 - 08:01 PM

steambotwallet.png

 

client.on('wallet', function(hasWallet, currency, balance) {
	if (balance >= 0) {
		let	playThis = CONFIG.PLAYGAMES;
			playThis = playThis.toString().replace(/replacebalance/,"游戏代购 ¥:" + balance);	
			console.log("### This bot have Wallet Balance: " + balance)
			wallet = balance;
	}
});
client.on("friendMessage", function(steamID, message) {
	if (message == "!check") {
		client.chatMessage(steamID, "我账号上面还有:¥" + wallet);
	};
});
 
hello every one 
i user this code can check my bot  wallet, is there any possible i can get how many csgokeys my robot has?


#2 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 1,815 posts

Posted 28 September 2018 - 10:56 PM

Get your inventory contents.



#3 venfiw

venfiw

    Member

  • Member
  • PipPip
  • 13 posts

Posted 01 October 2018 - 09:45 PM

%21keys.png

 

 

thank u sir i make it now



#4 venfiw

venfiw

    Member

  • Member
  • PipPip
  • 13 posts

Posted 02 October 2018 - 12:55 AM

@reload.png

 

I thought this is my finally version



#5 venfiw

venfiw

    Member

  • Member
  • PipPip
  • 13 posts

Posted 02 October 2018 - 11:24 PM

 

Hi Sir

I thought find a very strange problem.

I used two accounts run a same code, it works, code is here:

	if (message == "!inventory") {
		client.chatMessage(steamID,"I got your commands, please wait");
		community.getUserInventoryContents("[U:1:136393544]", 730, 2, true, (ERR, INV, CURR, TOL) => {
			console.log(INV)
			var itemname = "";
			for (var i = 0; i < INV.length; i++) {
					itemname += "<" + i + ">" + INV[i].market_hash_name + "\n";
			}
			client.chatMessage(steamID, "Here is my Inventory info: \nALL items : " + TOL + " Tradable : " + INV.length);
			client.chatMessage(steamID, "TradableList : \n" + itemname);
		})
	}

i user a other code ,i thought this code can count my csgo keys by load twice or more times inventory

and it works, when i login bot1 check bot2 inventory,

function reload(steamID){
	client.chatMessage(steamID,"I got your commands, please wait");
	for (var i = 0; i < CONFIG.CHECKLIST.length; i++) {
		searchitem(steamID,CONFIG.STEAMUID, CONFIG.CHECKLIST[i]);
	}
}

function searchitem(steamID, steamuid, scmname){
		community.getUserInventoryContents(steamuid, 730, 2, false, (ERR, INV, CURR, TOL) => {
			if (ERR) {
				console.log("err")
			} else {
				console.log("Search " + scmname);
				var amount = 0;
				for (var i = 0; i < INV.length; i++) {
					if (INV[i].market_hash_name == scmname){
						console.log("  ## Inventory Number: " + i);
						amount++;
					}
				}
				client.chatMessage(steamID,scmname + " : " + amount);
			}
		});
 }
module.exports ={
    STEAMUID: "[U:1:840063816]",
    CHECKLIST: [
            "Chroma Case Key",//幻彩123光谱12伽马12
            "Chroma 2 Case Key",
            "Chroma 3 Case Key",
            "Spectrum Case Key",
            "Spectrum 2 Case Key",
            "Gamma Case Key",
            "Gamma 2 Case Key",
            "Horizon Case Key",//地平命悬手套弯曲暗影
            "Clutch Case Key",
            "Glove Case Key",
            "Falchion Case Key",
            "Shadow Case Key",
            "eSports Key",//电竞左轮原生猎人大行动
            "Revolver Case Key",
            "CS:GO Case Key",
            "Huntsman Case Key",
            "Winter Offensive Case Key",
            "Operation Breakout Case Key",
            "Operation Wildfire Case Key",
            "Operation Vanguard Case Key",
            "Operation Phoenix Case Key",
        ]
}

then Strange things happened, when i login bot2 check bot2 inventory, i get error,When the second execution of the command getUserInventoryContents, 

The same result happens on another account. 

bot1 can load bot2 bot3 and other account's inventory twice or more, Except himself

bot2 can load bot1 bot3 and other account's inventory twice or more, Except himself

%21keyserr.png

 

SO i thought maybe wen can't load  myown inventory toomany times.

 

then i user once load

function checkitem(steamID){
	community.getUserInventoryContents(CONFIG.STEAMUID, 730, 2, false, (ERR, INV, CURR, TOL) => {
		if (ERR) {
			console.log("err")
		} else {
			var amount = new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
			for (var i = 0; i < INV.length; i++) {
				for (var j = 0; j < CONFIG.CHECKLIST.length; j++) {
					if (INV[i].market_hash_name == CONFIG.CHECKLIST[j]){
						console.log("  ## Inventory Number: " + i);
						amount[j]++;
					}
				}
			}
			var message =""
			for (var i = 0; i < CONFIG.CHECKLIST.length; i++) {
				message = message + CONFIG.CHECKLIST[i] + " : " + amount[i] + "\n"
			}
				client.chatMessage(steamID,message)
		}
	});
}	

finally i make it







Also tagged with one or more of these keywords: node.js, node-steamcommunity

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users