给所有想要制作STEAM自动发货机器人,淘宝自动发货,各种STEAM相关网站的朋友
使用全开源库,让你掌控每一步
语言:NODE(NODE大法好)
平台: WIN /MAC /LINUX
一直在做STEAM相关的开发,也经常帮人做,合作过几家网站,现在平时越来越忙,也有很多人开始关注这方面,那就把相关技术写出来给大家参考下~源码私信,过段时间发到GIT上
var SteamUser = require('steam-user');//引用库
var client = new SteamUser(); //实例化
client.logOn({
accountName: username,
password: password
});
//登陆 accountName 用户名 password 密码
4.我们希望登陆成功或者失败都在NODE上返回一定的信息,那么就可以在登陆对象上绑定对应的事件。比如,成功了显示登陆账号的信息,失败了返回原因。完成这步后任然看不到账号上线,因为还缺了最后一步,获取cookie
client.on('loggedOn', function(details) {
logger.info("Logged into Steam as " + client.steamID.getSteam3RenderedID())
});
client.on('error', function(e) {
logger.error(e);
process.exit(1)
});
5.登陆的最后一步,就是获取session,有了这个才可以读取账号的offer等各种信息。获取session后,我们就可以读取用户库存状态等操作,然后保持正常的登陆状态
570是DOTA2,CSGO是730
client.on('webSession', function(sessionID, cookies) {
logger.debug("Got web session");
client.setPersona(SteamUser.Steam.EPersonaState.Online);
offers.getUserInventoryContents(client.steamID, 570, 2, true, function(err, inventory, currencies) {
if (err) {
console.log(err);
return false
} else {
console.log("get DOTA2 items", inventory.length)
}
})
})
});
client.on('emailInfo', function(address, validated) {
logger.info("Our email address is " + address + " and it's " + (validated ? "validated" : "not validated"))
});//获取用户绑定E-mail信息
client.on('wallet', function(hasWallet, currency, balance) {
if (hasWallet) {
logger.info("We have " + SteamUser.formatCurrency(balance, currency) + " Steam wallet credit remaining")
} else {
logger.info("We do not have a Steam wallet.")
}
}); //获取用户STEAM钱包信息
client.on('tradeOffers', function(count) {
console.log("we have " + count + "offers")
});//获取用户未接受的Offer信息
client.on('friendsList', function() {
for (steamID in client.myFriends) {
friendcount++;
if (client.myFriends[steamID] === SteamUser.Steam.EFriendRelationship.RequestRecipient) {
logger.info("Friend request while offline from: " + steamID);
client.addFriend(steamID)
}
}
logger.debug("We have " + friendcount + " friends.");
});//获取好友列表
以上就是登陆模块的基本流程和操作,其实没什么难度。有问题多查查文档