Skip to content

Commit

Permalink
Add 3 more variables to commands
Browse files Browse the repository at this point in the history
  • Loading branch information
raimannma committed Jan 19, 2025
1 parent 380dead commit 80fffb4
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 30 deletions.
39 changes: 39 additions & 0 deletions deadlock_data_api/routers/v1_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,45 @@ def losses_today(
losses = sum(m.match_result != m.player_team for m in matches)
return str(losses)

def highest_kill_count(
self,
account_id: int,
*args,
**kwargs,
) -> str:
"""Get the highest kill count in a match"""
account_id = utils.validate_steam_id(account_id)
matches = requests.get(
f"https://analytics.deadlock-api.com/v2/players/{account_id}/match-history"
).json()
return str(max((m.get("player_kills", 0) for m in matches), default=0))

def total_kills(
self,
account_id: int,
*args,
**kwargs,
) -> str:
"""Get the total kills in all matches"""
account_id = utils.validate_steam_id(account_id)
matches = requests.get(
f"https://analytics.deadlock-api.com/v2/players/{account_id}/match-history"
).json()
return str(sum(m.get("player_kills", 0) for m in matches))

def total_matches(
self,
account_id: int,
*args,
**kwargs,
) -> str:
"""Get the total number of matches played"""
account_id = utils.validate_steam_id(account_id)
matches = requests.get(
f"https://analytics.deadlock-api.com/v2/players/{account_id}/match-history"
).json()
return str(len(matches))

def latest_patchnotes_title(
self,
*args,
Expand Down
60 changes: 30 additions & 30 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 80fffb4

Please sign in to comment.