mirror of
https://github.com/rangermix/TwitchDropsMiner.git
synced 2026-05-26 07:08:04 +00:00
Game slugs are now sourced from Twitch, instead of being generated
This commit is contained in:
@@ -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
|
||||
|
||||
7
utils.py
7
utils.py
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user