Game slugs are now sourced from Twitch, instead of being generated

This commit is contained in:
DevilXD committed 2023-11-10 21:35:49 +01:00
1 parent f1d76e00e7
commit 5167d95051
2 files changed
+6 -3

No files matched your search

+1 -1
View File
@@ -290,7 +290,7 @@ GQL_OPERATIONS: dict[str, GQLOperation] = {
# returns extended information about a particular campaign # returns extended information about a particular campaign
"CampaignDetails": GQLOperation( "CampaignDetails": GQLOperation(
"DropCampaignDetails", "DropCampaignDetails",
"f6396f5ffdde867a8f6f6da18286e4baf02e5b98d14689a69b5af320a4c7b7b8", "e5916665a37150808f8ad053ed6394b225d5504d175c7c0b01b9a89634c57136",
variables={ variables={
"channelLogin": ..., # user login "channelLogin": ..., # user login
"dropID": ..., # campaign ID "dropID": ..., # campaign ID
+5 -2
View File
@@ -16,6 +16,7 @@ from enum import Enum
from pathlib import Path from pathlib import Path
from functools import wraps from functools import wraps
from contextlib import suppress from contextlib import suppress
from functools import cached_property
from datetime import datetime, timezone from datetime import datetime, timezone
from collections import abc, OrderedDict from collections import abc, OrderedDict
from typing import ( from typing import (
@@ -388,7 +389,9 @@ class AwaitableValue(Generic[_T]):
class Game: class Game:
def __init__(self, data: JsonType): def __init__(self, data: JsonType):
self.id: int = int(data["id"]) 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: def __str__(self) -> str:
return self.name return self.name
@@ -404,7 +407,7 @@ class Game:
def __hash__(self) -> int: def __hash__(self) -> int:
return self.id return self.id
@property @cached_property
def slug(self) -> str: def slug(self) -> str:
""" """
Converts the game name into a slug, useable for the GQL API. Converts the game name into a slug, useable for the GQL API.