mirror of
https://github.com/rangermix/TwitchDropsMiner.git
synced 2026-05-30 17:09:36 +00:00
Fix isEnabled KeyError
This commit is contained in:
@@ -200,7 +200,9 @@ class Channel:
|
||||
)
|
||||
if response:
|
||||
stream_data = response["data"]["user"]
|
||||
self.id = int(stream_data["id"]) # fill channel_id
|
||||
# fill channel_id and name
|
||||
self.id = int(stream_data["id"])
|
||||
self.name = stream_data["displayName"]
|
||||
if stream_data["stream"]:
|
||||
self._stream = Stream(self, stream_data)
|
||||
else:
|
||||
|
||||
@@ -109,7 +109,7 @@ GQL_OPERATIONS: Dict[str, GQLOperation] = {
|
||||
# returns all in-progress campaigns
|
||||
"Inventory": GQLOperation(
|
||||
"Inventory",
|
||||
"e0765ebaa8e8eeb4043cc6dfeab3eac7f682ef5f724b81367e6e55c7aef2be4c",
|
||||
"27f074f54ff74e0b05c8244ef2667180c2f911255e589ccd693a1a52ccca7367",
|
||||
),
|
||||
# returns current state of drops (current drop progress)
|
||||
"CurrentDrop": GQLOperation(
|
||||
|
||||
@@ -12,6 +12,11 @@ if TYPE_CHECKING:
|
||||
from twitch import Twitch
|
||||
|
||||
|
||||
class Benefit:
|
||||
def __init__(self) -> None:
|
||||
pass
|
||||
|
||||
|
||||
class BaseDrop:
|
||||
def __init__(self, campaign: DropsCampaign, data: JsonType, claimed_benefits: Set[str]):
|
||||
self._twitch: Twitch = campaign._twitch
|
||||
@@ -172,10 +177,10 @@ class DropsCampaign:
|
||||
allowed = data["allow"]
|
||||
self.allowed_channels: List[Channel] = (
|
||||
[
|
||||
Channel(twitch, ch["id"], ch["displayName"], priority=True)
|
||||
Channel(twitch, ch["id"], ch.get("displayName", ch["name"]), priority=True)
|
||||
for ch in allowed["channels"]
|
||||
]
|
||||
if allowed["channels"] and allowed["isEnabled"] else []
|
||||
if allowed["channels"] and allowed.get("isEnabled", True) else []
|
||||
)
|
||||
self.timed_drops: Dict[str, TimedDrop] = {
|
||||
drop_data["id"]: TimedDrop(self, drop_data, claimed_benefits)
|
||||
|
||||
Reference in New Issue
Block a user