Skip to content

Commit bdafd0e

Browse files
Merge pull request #215
* Added missing _cached_rewards attribute * Corrected the custom rewards json keys
1 parent 98a89f1 commit bdafd0e

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

twitchio/rewards.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class CustomReward:
6767
def __init__(self, http: "TwitchHTTP", obj: dict, channel: "PartialUser"):
6868
self._http = http
6969
self._channel = channel
70-
self._broadcaster_id = obj["channel_id"]
70+
self._broadcaster_id = obj["broadcaster_id"]
7171

7272
self.id = obj["id"]
7373
self.image = obj["image"]["url_1x"] if obj["image"] else obj["default_image"]["url_1x"]
@@ -78,16 +78,16 @@ def __init__(self, http: "TwitchHTTP", obj: dict, channel: "PartialUser"):
7878
self.prompt = obj["prompt"]
7979
self.input_required = obj["is_user_input_required"]
8080
self.max_per_stream = (
81-
obj["max_per_stream"]["is_enabled"],
82-
obj["max_per_stream"]["max_per_stream"],
81+
obj["max_per_stream_setting"]["is_enabled"],
82+
obj["max_per_stream_setting"]["max_per_stream"],
8383
)
8484
self.max_per_user_stream = (
85-
obj["max_per_user_per_stream"]["is_enabled"],
86-
obj["max_per_user_per_stream"]["max_per_user_per_stream"],
85+
obj["max_per_user_per_stream_setting"]["is_enabled"],
86+
obj["max_per_user_per_stream_setting"]["max_per_user_per_stream"],
8787
)
8888
self.cooldown = (
89-
obj["global_cooldown"]["is_enabled"],
90-
obj["global_cooldown"]["global_cooldown_seconds"],
89+
obj["global_cooldown_setting"]["is_enabled"],
90+
obj["global_cooldown_setting"]["global_cooldown_seconds"],
9191
)
9292
self.paused = obj["is_paused"]
9393
self.in_stock = obj["is_in_stock"]

twitchio/user.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,7 @@ def __init__(self, http: "TwitchHTTP", data: dict):
855855
self.view_count = (data["view_count"],)
856856
self.created_at = data["created_at"]
857857
self.email = data.get("email")
858+
self._cached_rewards = None
858859

859860
def __repr__(self):
860861
return f"<User id={self.id} name={self.name} display_name={self.display_name} type={self.type}>"

0 commit comments

Comments
 (0)