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

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

View File

@@ -290,7 +290,7 @@ GQL_OPERATIONS: dict[str, GQLOperation] = {
# returns extended information about a particular campaign
"CampaignDetails": GQLOperation(
"DropCampaignDetails",
"f6396f5ffdde867a8f6f6da18286e4baf02e5b98d14689a69b5af320a4c7b7b8",
"e5916665a37150808f8ad053ed6394b225d5504d175c7c0b01b9a89634c57136",
variables={
"channelLogin": ..., # user login
"dropID": ..., # campaign ID

View File

@@ -16,6 +16,7 @@ from enum import Enum
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 (
@@ -388,7 +389,9 @@ class AwaitableValue(Generic[_T]):
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
@@ -404,7 +407,7 @@ class Game:
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.