Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var Steam = require("steam");
- var SteamUser = require("steam-user");
- var SteamApi = require('steam-api');
- var dota2 = require('dota2');
- var STEAM_API_KEY = "";
- var optionalSteamId = '';
- var fs = require('fs');
- var nodeDotaApi = require('node-dota-api');
- var async = require('async');
- var user = new SteamApi.User("", optionalSteamId);
- var client = new SteamUser();
- var friends = new Steam.SteamFriends(client.client);
- var Dota2 = new dota2.Dota2Client(client, true);
- //sindeete to bot (OXI TO MAIN ACCOUNT MOU) , kai to dixnei an paizei dota 2
- client.on("loggedOn", function (details) {
- console.log("logged on to steam ! with the steam id " + client.steamID.getSteam3RenderedID());
- client.setPersona(SteamUser.Steam.EPersonaState.Online);
- client.gamesPlayed(570);
- });
- client.on("error", e =>console.error(e)); {
- console.log("error");
- };
- var steamID = '76561198058632219';
- var playerID = Dota2.ToAccountID(steamID);
- //pernw ta mmr
- nodeDotaApi.playerStats(playerID, function (res) {
- if (res) return (console.log(JSON.stringify(res)));
- });
- function myFriendListIds(optionalSteamId,callback){
- user.GetFriendList(optionalRelationship = 'all', optionalSteamId).done(function (result) { //to api call pou pernei tis plirofories apo to friendlist tou main acc mou
- var ArrayWithId = [];
- for (i in result) {
- ArrayWithId.push(result[i]['steamId']); //pinakas me ta steam id tou main acc pou trexei to API CALL tis valve
- }
- return user
- .GetFriendList(optionalRelationship = 'all', optionalSteamId)
- .then(result => result.map(user => user.streamId))
- });
- }
- //kalw to function pou ekana apo panw me callback gia na mporesw na parw to return pou mou dinei!
- myFriendListIds(optionalSteamId, function (res) {
- fs.writeFile('IDS.txt' , res , function (err) {
- if(err) throw err;
- console.log("Done");
- })
- });
- var text = fs.readFileSync('IDS.txt', 'utf8');
- var friendsids = [];
- var txt = JSON.parse(text);
- for (var i in txt) {
- friendsids.push(txt[i]);
- }
- console.log(friendsids);
- for(let i = 0; i < 100; i++) {
- setTimeout(function() {
- user.GetFriendList(optionalRelationship = 'all', friendsids[i]).done(function (res) {
- console.log(res);
- console.log(i);
- });
- }, 10000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement