student, climber, programmer


This project was my first endeavor in using an API for a practical project. As an avid Overwatch player, I often find myself wishing that I was able to compare my statistics from between sessions. Overwatch only displays your current rating rather than giving you a historical log of skill rating (SR) data like some other games, so I decided to create this discord bot that would keep a log of changes in a player’s SR.

* This project is still a work in progress, so all elements may not work as intended when run.
** This preview may not include the full project. All files are uploaded to my GitHub.

""" Full code uploaded to GitHub """
import requests import json import time import pathlib path = pathlib.Path(__file__).parent.resolve() usernames = ["Park-12632"] def writeSR(role, sr): f = open(f"{path}/logs/{username}_{role}.log", 'a') f.write(str(sr) + "\n") print(f"updated {username}_{role}.log") def checkFile(role): try: f = open(f"{path}/logs/{username}_{role}.log", 'r') last_line = f.readlines()[-1:] split = str(last_line).split("'")[1].split("\\")[0] return int(split) except IOError: f = open(f"{path}/logs/{username}_{role}.log", 'a') return -1 def getSR(username, doPrint): r = requests.get(f"{username}/profile") r = r.json() try: for arr in r['ratings']: role = arr['role'] sr = arr['level'] fileExists = checkFile(role)
""" Full code uploaded to GitHub """