Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.34 KB | None | 0 0
  1. var Steam = require("steam");
  2. var SteamUser = require("steam-user");
  3. var SteamApi = require('steam-api');
  4. var dota2 = require('dota2');
  5. var STEAM_API_KEY = "";
  6. var optionalSteamId = '';
  7. var fs = require('fs');
  8. var nodeDotaApi = require('node-dota-api');
  9. var async = require('async');
  10.  
  11.  
  12. var user = new SteamApi.User("", optionalSteamId);
  13. var client = new SteamUser();
  14. var friends = new Steam.SteamFriends(client.client);
  15. var Dota2 = new dota2.Dota2Client(client, true);
  16.  
  17.  
  18. client.logOn({
  19.  
  20. "accountName": "rnsparkour1",
  21. "password": "Parkour668658"
  22. });
  23. //sindeete to bot (OXI TO MAIN ACCOUNT MOU) , kai to dixnei an paizei dota 2
  24. client.on("loggedOn", function (details) {
  25. console.log("logged on to steam ! with the steam id " + client.steamID.getSteam3RenderedID());
  26. client.setPersona(SteamUser.Steam.EPersonaState.Online);
  27. client.gamesPlayed(570);
  28. });
  29.  
  30. client.on("error", function (error) {
  31. console.log("error");
  32.  
  33. });
  34.  
  35. var steamID = '76561198058632219';
  36. var playerID = Dota2.ToAccountID(steamID);
  37. //pernw ta mmr
  38. nodeDotaApi.playerStats(playerID, function (res) {
  39. if (res) return (console.log(JSON.stringify(res)));
  40.  
  41. });
  42.  
  43. function myFriendListIds(optionalSteamId,callback){
  44.  
  45. user.GetFriendList(optionalRelationship = 'all', optionalSteamId).done(function (result) { //to api call pou pernei tis plirofories apo to friendlist tou main acc mou
  46.  
  47. var ArrayWithId = [];
  48.  
  49.  
  50. for (i in result) {
  51. ArrayWithId.push(result[i]['steamId']); //pinakas me ta steam id tou main acc pou trexei to API CALL tis valve
  52. }
  53. callback(JSON.stringify(ArrayWithId));
  54. });
  55. }
  56. //kalw to function pou ekana apo panw me callback gia na mporesw na parw to return pou mou dinei!
  57.  
  58. myFriendListIds(optionalSteamId, function (res) {
  59. fs.writeFile('IDS.txt' , res , function (err) {
  60. if(err) throw err;
  61. console.log("Done");
  62.  
  63. })
  64. });
  65.  
  66.  
  67. var text = fs.readFileSync('IDS.txt', 'utf8');
  68. var friendsids = [];
  69. var txt = JSON.parse(text);
  70. for (var i in txt) {
  71. friendsids.push(txt[i]);
  72. }
  73. console.log(friendsids);
  74.  
  75.  
  76.  
  77. for(let i = 0; i < 11; i++) {
  78. setTimeout(function() {
  79. user.GetFriendList(optionalRelationship = 'all', friendsids[i]).done(function (res) {
  80. console.log(res);
  81. console.log(i);
  82. });
  83.  
  84. }, 10000);
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement