Skip to content

Commit

Permalink
BlockedTerm rename
Browse files Browse the repository at this point in the history
This is to avoid conflict with Helix model of same name
  • Loading branch information
chillymosh committed Dec 13, 2024
1 parent 0865fa4 commit b20a069
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions twitchio/models/eventsub_.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class Boundary(NamedTuple):
end: int


class BlockedTerm:
class AutomodBlockedTerm:
"""
Represents a blocked term from AutoMod.
Expand All @@ -100,7 +100,7 @@ class BlockedTerm:

__slots__ = ("boundary", "id", "owner")

def __init__(self, payload: AutomodBlockedTerm, *, http: HTTPClient) -> None:
def __init__(self, payload: AutomodBlockedTermData, *, http: HTTPClient) -> None:
self.id: str = payload["term_id"]
self.owner: PartialUser = PartialUser(
payload["owner_broadcaster_user_id"],
Expand Down Expand Up @@ -136,7 +136,7 @@ class AutomodMessageHold(BaseEvent):
The datetime of when automod saved the message.
fragments: list[ChatMessageFragment]
List of chat message fragments.
reason: Literal["automod", "blocked_term"] | None
reason: typing.Literal["automod", "blocked_term"] | None
The reason for the message being held. This is only populated for the V2 endpoint.
boundaries: list[Boundary]
The start and end index of the words caught by automod. This is only populated for the V2 endpoint and when the reason is `automod`.
Expand Down Expand Up @@ -183,7 +183,7 @@ def __init__(self, payload: AutomodMessageHoldEvent | AutomodMessageHoldV2Event,
self.boundaries: list[Boundary] = [Boundary(boundary["start_pos"], boundary["end_pos"]) for boundary in boundaries]

blocked_terms = blocked_term_data.get("terms_found", [])
self.blocked_terms: list[BlockedTerm] = [BlockedTerm(term, http=http) for term in blocked_terms]
self.blocked_terms: list[AutomodBlockedTerm] = [AutomodBlockedTerm(term, http=http) for term in blocked_terms]

def __repr__(self) -> str:
return f"<AutomodMessageHold broadcaster={self.broadcaster} user={self.user} message_id={self.message_id} level={self.level}>"
Expand Down Expand Up @@ -217,7 +217,7 @@ def cheermotes(self) -> list[ChatMessageCheermote]:

class AutomodMessageUpdate(AutomodMessageHold):
"""
Represents an automod message update event.
Represents an automod message update event. Both V1 and V2.
Attributes
----------
Expand Down Expand Up @@ -250,7 +250,7 @@ class AutomodMessageUpdate(AutomodMessageHold):
- Denied
- Expired
reason: Literal["automod", "blocked_term"] | None
reason: typing.Literal["automod", "blocked_term"] | None
The reason for the message being held. This is only populated for the V2 endpoint.
boundaries: list[Boundary]
The start and end index of the words caught by automod. This is only populated for the V2 endpoint and when the reason is `automod`.
Expand Down
6 changes: 3 additions & 3 deletions twitchio/types_/eventsub.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@


__all__ = (
"AutomodBlockedTerm",
"AutomodBlockedTermData",
"AutomodMessageHoldEvent",
"AutomodMessageHoldV2Event",
"AutomodMessageUpdateEvent",
Expand Down Expand Up @@ -283,7 +283,7 @@ class AutomodV2Data(TypedDict):
boundaries: list[AutomodBoundaries]


class AutomodBlockedTerm(TypedDict):
class AutomodBlockedTermData(TypedDict):
term_id: str
boundary: AutomodBoundaries
owner_broadcaster_user_id: str
Expand All @@ -292,7 +292,7 @@ class AutomodBlockedTerm(TypedDict):


class AutomodBlockedTerms(TypedDict):
terms_found: list[AutomodBlockedTerm]
terms_found: list[AutomodBlockedTermData]


class AutomodMessageHoldV2Event(BroadcasterUserEvent):
Expand Down

0 comments on commit b20a069

Please sign in to comment.