Esempio n. 1
0
 def __init__(self, client: EventSubClient, data: dict):
     self.broadcaster = _transform_user(client, data, "broadcaster_user")
     self.prediction_id: str = data["id"]
     self.title: str = data["title"]
     self.outcomes = [
         PredictionOutcome(client, x) for x in data["outcomes"]
     ]
     self.started_at = _parse_datetime(data["started_at"])
     self.locked_at = _parse_datetime(data["locked_at"])
Esempio n. 2
0
 def __init__(self, client: EventSubClient, data: dict):
     self.broadcaster = _transform_user(client, data, "broadcaster_user")
     self.total_points: int = data["total"]
     self.level: int = data["level"]
     self.started = _parse_datetime(data["started_at"])
     self.ended = _parse_datetime(data["ended_at"])
     self.cooldown_ends_at = _parse_datetime(data["cooldown_ends_at"])
     self.top_contributions = [
         HypeTrainContributor(client, d) for d in data["top_contributions"]
     ]
Esempio n. 3
0
 def __init__(self, client: EventSubClient, data: dict):
     self.broadcaster = _transform_user(client, data, "broadcaster_user")
     self.poll_id: str = data["id"]
     self.title: str = data["title"]
     self.choices = [PollChoice(c) for c in data["choices"]]
     self.bits_voting = BitsVoting(data["bits_voting"])
     self.channel_points_voting = ChannelPointsVoting(
         data["channel_points_voting"])
     self.started_at = _parse_datetime(data["started_at"])
     self.ends_at = _parse_datetime(data["ends_at"])
Esempio n. 4
0
 def __init__(self, client: EventSubClient, data: dict):
     self.broadcaster = _transform_user(client, data, "broadcaster_user")
     self.prediction_id: str = data["id"]
     self.title: str = data["title"]
     self.winning_outcome_id: str = data["winning_outcome_id"]
     self.outcomes = [
         PredictionOutcome(client, x) for x in data["outcomes"]
     ]
     self.status = PredictionStatus(data["status"].lower())
     self.started_at = _parse_datetime(data["started_at"])
     self.ended_at = _parse_datetime(data["ended_at"])
Esempio n. 5
0
 def __init__(self, client: EventSubClient, data: dict):
     self.broadcaster = _transform_user(client, data, "broadcaster_user")
     self.total_points: int = data["total"]
     self.progress: int = data["progress"]
     self.goal: int = data["goal"]
     self.started = _parse_datetime(data["started_at"])
     self.expires = _parse_datetime(data["expire_at"])
     self.top_contributions = [
         HypeTrainContributor(client, d) for d in data["top_contributions"]
     ]
     self.last_contribution = HypeTrainContributor(
         client, data["last_contribution"])
Esempio n. 6
0
 def __init__(self, client: EventSubClient, data: dict):
     self.broadcaster = _transform_user(client, data, "broadcaster_user")
     self.user = _transform_user(client, data, "user")
     self.id: str = data["id"]
     self.input: str = data["user_input"]
     self.status: Literal["unknown", "unfulfilled", "fulfilled",
                          "cancelled"] = data["status"]
     self.redeemed_at = _parse_datetime(data["redeemed_at"])
     self.reward = CustomReward(client.client._http, data["reward"],
                                self.broadcaster)
Esempio n. 7
0
 def __init__(self, client: EventSubClient, data: dict):
     self.user = _transform_user(client, data, "user")
     self.broadcaster = _transform_user(client, data, "broadcaster_user")
     self.moderator = _transform_user(client, data, "moderator_user")
     self.reason: str = data["reason"]
     self.ends_at: Optional[
         datetime.datetime] = data["ends_at"] and _parse_datetime(
             data["ends_at"])
     self.permenant: bool = data["is_permanent"]
     self.permanent = self.permenant  # fix the spelling while keeping backwards compat
Esempio n. 8
0
 def __init__(self, data: dict):
     self.id: str = data["id"]
     self.status: str = data["status"]
     self.type: str = data["type"]
     self.version = int(data["version"])
     self.cost: int = data["cost"]
     self.condition: Dict[str, str] = data["condition"]
     self.created_at = _parse_datetime(data["created_at"])
     self.transport = EmptyObject()
     self.transport.method: str = data["transport"]["method"]  # noqa
     self.transport.callback: str = data["transport"]["callback"]  # noqa
Esempio n. 9
0
 def __init__(self, request: web.Request):
     self.message_id: str = request.headers["Twitch-Eventsub-Message-Id"]
     self.message_retry: int = int(
         request.headers["Twitch-Eventsub-Message-Retry"])
     self.message_type: str = request.headers[
         "Twitch-Eventsub-Message-Type"]
     self.signature: str = request.headers[
         "Twitch-Eventsub-Message-Signature"]
     self.subscription_type: str = request.headers[
         "Twitch-Eventsub-Subscription-Type"]
     self.subscription_version: str = request.headers[
         "Twitch-Eventsub-Subscription-Version"]
     self.timestamp = _parse_datetime(
         request.headers["Twitch-Eventsub-Message-Timestamp"])
     self._raw_timestamp = request.headers[
         "Twitch-Eventsub-Message-Timestamp"]
Esempio n. 10
0
 def __init__(self, client: EventSubClient, data: dict):
     self.broadcaster = _transform_user(client, data, "broadcaster_user")
     self.id: str = data["id"]
     self.type: Literal["live", "playlist", "watch_party", "premier",
                        "rerun"] = data["type"]
     self.started_at = _parse_datetime(data["started_at"])
Esempio n. 11
0
 def __init__(self, client: EventSubClient, data: dict):
     self.user = _transform_user(client, data, "user")
     self.broadcaster = _transform_user(client, data, "broadcaster_user")
     self.followed_at = _parse_datetime(data["followed_at"])