Merge pull request #228 from opatut/dota2win-username

dota2wins: allow finding steam ID by username
This commit is contained in:
enkore 2015-08-17 10:36:37 +02:00
commit 046cdf07c6

View File

@ -42,6 +42,11 @@ class Dota2wins(IntervalModule):
def run(self): def run(self):
api.set_api_key(self.steam_api_key) api.set_api_key(self.steam_api_key)
if not isinstance(self.steamid, int):
# find by username
self.steamid = int(api.get_steam_id(self.steamid)['response']['steamid'])
hist = api.get_match_history(account_id=self.steamid)['result'] hist = api.get_match_history(account_id=self.steamid)['result']
recent_matches = [] recent_matches = []
while len(recent_matches) < self.matches: while len(recent_matches) < self.matches: