Fix isEnabled KeyError
This commit is contained in:
1 parent
7e5f34748b
commit
75179dc69f
3 files changed
+11
-4
No files matched your search
+3
-1
@@ -200,7 +200,9 @@ class Channel:
|
|||||||
)
|
)
|
||||||
if response:
|
if response:
|
||||||
stream_data = response["data"]["user"]
|
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"]:
|
if stream_data["stream"]:
|
||||||
self._stream = Stream(self, stream_data)
|
self._stream = Stream(self, stream_data)
|
||||||
else:
|
else:
|
||||||
|
|||||||
+1
-1
@@ -109,7 +109,7 @@ GQL_OPERATIONS: Dict[str, GQLOperation] = {
|
|||||||
# returns all in-progress campaigns
|
# returns all in-progress campaigns
|
||||||
"Inventory": GQLOperation(
|
"Inventory": GQLOperation(
|
||||||
"Inventory",
|
"Inventory",
|
||||||
"e0765ebaa8e8eeb4043cc6dfeab3eac7f682ef5f724b81367e6e55c7aef2be4c",
|
"27f074f54ff74e0b05c8244ef2667180c2f911255e589ccd693a1a52ccca7367",
|
||||||
),
|
),
|
||||||
# returns current state of drops (current drop progress)
|
# returns current state of drops (current drop progress)
|
||||||
"CurrentDrop": GQLOperation(
|
"CurrentDrop": GQLOperation(
|
||||||
|
|||||||
+7
-2
@@ -12,6 +12,11 @@ if TYPE_CHECKING:
|
|||||||
from twitch import Twitch
|
from twitch import Twitch
|
||||||
|
|
||||||
|
|
||||||
|
class Benefit:
|
||||||
|
def __init__(self) -> None:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class BaseDrop:
|
class BaseDrop:
|
||||||
def __init__(self, campaign: DropsCampaign, data: JsonType, claimed_benefits: Set[str]):
|
def __init__(self, campaign: DropsCampaign, data: JsonType, claimed_benefits: Set[str]):
|
||||||
self._twitch: Twitch = campaign._twitch
|
self._twitch: Twitch = campaign._twitch
|
||||||
@@ -172,10 +177,10 @@ class DropsCampaign:
|
|||||||
allowed = data["allow"]
|
allowed = data["allow"]
|
||||||
self.allowed_channels: List[Channel] = (
|
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"]
|
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] = {
|
self.timed_drops: Dict[str, TimedDrop] = {
|
||||||
drop_data["id"]: TimedDrop(self, drop_data, claimed_benefits)
|
drop_data["id"]: TimedDrop(self, drop_data, claimed_benefits)
|
||||||
|
|||||||
Reference in new issue
Block a user