Advertisement
Guest User

Untitled

a guest
May 24th, 2018
383
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. from steam import SteamClient
  2. from dota2 import Dota2Client
  3. from steam.enums import EResult
  4. from steam.core.msg import MsgProto
  5. from steam.enums.emsg import EMsg
  6. import vdf
  7. client = SteamClient()
  8. dota = Dota2Client(client)
  9. game_modes={
  10. 1:"All Pick", 2:"Captains Mode", 3:"Random Draft", 4:"Single Draft",
  11. 5:"All Random", 6:"Intro", 7:"Diretide", 8:"Reverse Captains Mode",
  12. 9:"The Greeviling", 10:"Tutorial", 11:"Mid Only", 12:"Least Played",
  13. 13:"New Player Pool", 14:"Compendium Matchmaking", 15:"Custom Game",
  14. 16:"Captains Draft", 18:"Ability Draft", 19:"Frostivus",
  15. 20:"All Random Deathmatch", 21:"1v1 Mid Only", 22:"All Pick",
  16. 23:"TURBO", 24:"Mutation"
  17. }
  18. @client.on('logged_on')
  19. def start_dota():
  20. dota.launch()
  21.  
  22. @dota.on('ready')
  23. def do_dota_stuff():
  24. message = MsgProto(EMsg.ClientRichPresenceRequest)
  25. message.body.steamid_request.extend([76561198834285820,76561198821117459,76561198402813610,76561198804617230, 76561198431841319])
  26. message.header.routing_appid=570
  27. resp = client.send_message_and_wait(message, EMsg.ClientRichPresenceInfo)
  28. lobbies= []
  29. for rich_presence in resp.rich_presence:
  30. rp = vdf.binary_loads(rich_presence.rich_presence_kv)['RP']
  31. if 'WatchableGameID' in rp:
  32. print(rp['WatchableGameID'])
  33. lobbies.append(int(rp['WatchableGameID']))
  34. dota.request_top_source_tv_games(lobby_ids=lobbies)
  35.  
  36. @dota.on('top_source_tv_games')
  37. def watchtabresponse(result):
  38. if result.specific_games == True:
  39. #print(result)
  40. for game in result.game_list:
  41. txt = ''
  42. if game.game_mode in game_modes:
  43. txt+=game_modes[game.game_mode]
  44. else:
  45. txt+='None'
  46. print(txt)
  47. print(len(result.game_list))
  48. client.cli_login()
  49. client.run_forever()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement