-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add slash command to update co-found champion scoreboard
- Loading branch information
Showing
2 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import logging | ||
from typing import Literal | ||
|
||
import aiohttp | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
|
||
class StJudeScoreboardClient: | ||
def __init__(self): | ||
super().__init__() | ||
self._url = "https://stjude-scoreboard.snailedit.org/api/co-founders" | ||
|
||
async def update_score(self, co_founder: Literal["myke", "stephen"], score: int): | ||
async with aiohttp.ClientSession() as session: | ||
url = f"{self._url}/{co_founder}" | ||
await session.put(url, json={"score": score}, raise_for_status=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters