Skip to content

Commit

Permalink
Game slugs are now sourced from Twitch, instead of being generated
Browse files Browse the repository at this point in the history
  • Loading branch information
DevilXD committed Nov 10, 2023
1 parent f1d76e0 commit 5167d95
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def with_variables(self, variables: JsonType) -> GQLOperation:
# returns extended information about a particular campaign
"CampaignDetails": GQLOperation(
"DropCampaignDetails",
"f6396f5ffdde867a8f6f6da18286e4baf02e5b98d14689a69b5af320a4c7b7b8",
"e5916665a37150808f8ad053ed6394b225d5504d175c7c0b01b9a89634c57136",
variables={
"channelLogin": ..., # user login
"dropID": ..., # campaign ID
Expand Down
7 changes: 5 additions & 2 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from pathlib import Path
from functools import wraps
from contextlib import suppress
from functools import cached_property
from datetime import datetime, timezone
from collections import abc, OrderedDict
from typing import (
Expand Down Expand Up @@ -388,7 +389,9 @@ def clear(self) -> None:
class Game:
def __init__(self, data: JsonType):
self.id: int = int(data["id"])
self.name: str = data["name"]
self.name: str = data.get("displayName") or data["name"]
if "slug" in data:
self.slug = data["slug"]

def __str__(self) -> str:
return self.name
Expand All @@ -404,7 +407,7 @@ def __eq__(self, other: object) -> bool:
def __hash__(self) -> int:
return self.id

@property
@cached_property
def slug(self) -> str:
"""
Converts the game name into a slug, useable for the GQL API.
Expand Down

0 comments on commit 5167d95

Please sign in to comment.