initial commit

This commit is contained in:
2025-11-16 15:41:16 +00:00
commit 56f4d3b921
5 changed files with 1654 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
env/*

39
api_test.py Normal file
View File

@@ -0,0 +1,39 @@
import requests
import time
import json
from pypresence import Presence
from pypresence.types import ActivityType, StatusDisplayType
client_id = "1439626657978646559"
RPC = Presence(client_id)
RPC.connect()
def get_game_data():
try:
response = requests.get('https://127.0.0.1:2999/liveclientdata/allgamedata',
verify=False,
timeout=2)
return response.json()
except requests.exceptions.RequestException:
return None
while True:
data = get_game_data()
if data is None:
print("League isn't running or no game active")
time.sleep(3) # Poll every 3 seconds, reasonable limit for riot api
continue
# Parse and do stuff with data here
game_time = data['gameData']['gameTime']
print(f"Game time: {game_time:.0f}s")
# Show as "Listening to" instead of "Playing"
RPC.update(
activity_type=ActivityType.PLAYING,
details="My Favorite Song",
state="By My Favorite Artist"
)
time.sleep(15) # Poll every 15 seconds (discord update limit)

BIN
assets/lol-icon.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

BIN
requirements.txt Normal file

Binary file not shown.

1614
test.json Normal file

File diff suppressed because it is too large Load Diff