Skip to content

Commit 1bc381b

Browse files
chillymoshIAmTomahawkx
authored andcommitted
Docs
1 parent 76c0122 commit 1bc381b

File tree

3 files changed

+184
-36
lines changed

3 files changed

+184
-36
lines changed

docs/changelog.rst

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,28 @@
1616

1717
- ext.eventsub
1818
- Additions
19-
- Added :method:`Twitchio.ext.eventsub.EventSubClient.subscribe_channel_unban_request_create <EventSubClient.subscribe_channel_unban_request_create>` /
20-
:method:`Twitchio.ext.eventsub.EventSubWSClient.subscribe_channel_unban_request_create <EventSubWSClient.subscribe_channel_unban_request_create>`
21-
- Added :method:`Twitchio.ext.eventsub.EventSubClient.subscribe_channel_unban_request_resolve <EventSubClient.subscribe_channel_unban_request_resolve>` /
22-
:method:`Twitchio.ext.eventsub.EventSubWSClient.subscribe_channel_unban_request_resolve <EventSubWSClient.subscribe_channel_unban_request_resolve>`
23-
- Added :method:`Twitchio.ext.eventsub.EventSubClient.subscribe_automod_terms_update <EventSubClient.subscribe_automod_terms_update>` /
24-
:method:`Twitchio.ext.eventsub.EventSubWSClient.subscribe_automod_terms_update <EventSubClient.subscribe_automod_terms_update>`
25-
- Added :method:`Twitchio.ext.eventsub.EventSubClient.subscribe_automod_settings_update <EventSubClient.subscribe_automod_settings_update>` /
26-
:method:`Twitchio.ext.eventsub.EventSubWSClient.subscribe_automod_settings_update <EventSubClient.subscribe_automod_settings_update>`
27-
- Added :method:`Twitchio.ext.eventsub.EventSubClient.subscribe_automod_message_update <EventSubClient.subscribe_automod_message_update>` /
28-
:method:`Twitchio.ext.eventsub.EventSubWSClient.subscribe_automod_message_update <EventSubClient.subscribe_automod_message_update>`
29-
- Added :method:`Twitchio.ext.eventsub.EventSubClient.subscribe_automod_message_hold <EventSubClient.subscribe_automod_message_hold>` /
30-
:method:`Twitchio.ext.eventsub.EventSubWSClient.subscribe_automod_message_hold <EventSubClient.subscribe_automod_message_hold>`
19+
- Added :meth:`Twitchio.ext.eventsub.EventSubClient.subscribe_channel_unban_request_create <EventSubClient.subscribe_channel_unban_request_create>` /
20+
:meth:`Twitchio.ext.eventsub.EventSubWSClient.subscribe_channel_unban_request_create <EventSubWSClient.subscribe_channel_unban_request_create>`
21+
- Added :meth:`Twitchio.ext.eventsub.EventSubClient.subscribe_channel_unban_request_resolve <EventSubClient.subscribe_channel_unban_request_resolve>` /
22+
:meth:`Twitchio.ext.eventsub.EventSubWSClient.subscribe_channel_unban_request_resolve <EventSubWSClient.subscribe_channel_unban_request_resolve>`
23+
- Added :meth:`Twitchio.ext.eventsub.EventSubClient.subscribe_automod_terms_update <EventSubClient.subscribe_automod_terms_update>` /
24+
:meth:`Twitchio.ext.eventsub.EventSubWSClient.subscribe_automod_terms_update <EventSubClient.subscribe_automod_terms_update>`
25+
- Added :meth:`Twitchio.ext.eventsub.EventSubClient.subscribe_automod_settings_update <EventSubClient.subscribe_automod_settings_update>` /
26+
:meth:`Twitchio.ext.eventsub.EventSubWSClient.subscribe_automod_settings_update <EventSubClient.subscribe_automod_settings_update>`
27+
- Added :meth:`Twitchio.ext.eventsub.EventSubClient.subscribe_automod_message_update <EventSubClient.subscribe_automod_message_update>` /
28+
:meth:`Twitchio.ext.eventsub.EventSubWSClient.subscribe_automod_message_update <EventSubClient.subscribe_automod_message_update>`
29+
- Added :meth:`Twitchio.ext.eventsub.EventSubClient.subscribe_automod_message_hold <EventSubClient.subscribe_automod_message_hold>` /
30+
:meth:`Twitchio.ext.eventsub.EventSubWSClient.subscribe_automod_message_hold <EventSubClient.subscribe_automod_message_hold>`
31+
- Added :meth:`Twitchio.ext.eventsub.EventSubClient.subscribe_channel_moderate <EventSubClient.subscribe_channel_moderate>` /
32+
:meth:`Twitchio.ext.eventsub.EventSubWSClient.subscribe_channel_moderate <EventSubClient.subscribe_channel_moderate>`
33+
- Added :meth:`Twitchio.ext.eventsub.EventSubClient.channel_suspicious_user_update <EventSubClient.channel_suspicious_user_update>` /
34+
:meth:`Twitchio.ext.eventsub.EventSubWSClient.channel_suspicious_user_update <EventSubClient.channel_suspicious_user_update>`
3135
- Added all accompanying models for those endpoints.
3236
- ext.sounds
3337
- Additions
3438
- Added TinyTag as a dependency to support retrieving audio metadata using TinyTag in `ext.sounds.__init__.py`.
35-
- added :method:`Twitchio.ext.sounds.rate setter.
36-
- added :method:`Twitchio.ext.sounds.channels setter.
39+
- added :meth:`twitchio.ext.sounds.Sound.rate` setter.
40+
- added :meth:`twitchio.ext.sounds.Sound.channels` setter.
3741

3842

3943
2.9.2

docs/exts/eventsub.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,3 +530,15 @@ API Reference
530530
.. autoclass:: AutomodTermsUpdateData
531531
:members:
532532
:inherited-members:
533+
534+
.. attributetable::: SuspiciousUserUpdateData
535+
536+
.. autoclass:: SuspiciousUserUpdateData
537+
:members:
538+
:inherited-members:
539+
540+
.. attributetable::: ChannelModerateData
541+
542+
.. autoclass:: ChannelModerateData
543+
:members:
544+
:inherited-members:

twitchio/ext/eventsub/models.py

Lines changed: 154 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1929,6 +1929,36 @@ class ChannelModerateData(EventData):
19291929
The moderator who performed the action.
19301930
action: :class:`str`
19311931
The action performed.
1932+
followers: Optional[:class:`Followers`]
1933+
Metadata associated with the followers command.
1934+
slow: Optional[:class:`Slow`]
1935+
Metadata associated with the slow command.
1936+
vip: Optional[:class:`VIPStatus`]
1937+
Metadata associated with the vip command.
1938+
unvip: Optional[:class:`VIPStatus`]
1939+
Metadata associated with the vip command.
1940+
mod: Optional[:class:`ModStatus`]
1941+
Metadata associated with the mod command.
1942+
unmod: Optional[:class:`ModStatus`]
1943+
Metadata associated with the mod command.
1944+
ban: Optional[:class:`BanStatus`]
1945+
Metadata associated with the ban command.
1946+
unban: Optional[:class:`BanStatus`]
1947+
Metadata associated with the unban command.
1948+
timeout: Optional[:class:`TimeoutStatus`]
1949+
Metadata associated with the timeout command.
1950+
untimeout: Optional[:class:`TimeoutStatus`]
1951+
Metadata associated with the untimeout command.
1952+
raid: Optional[:class:`RaidStatus`]
1953+
Metadata associated with the raid command.
1954+
unraid: Optional[:class:`RaidStatus`]
1955+
Metadata associated with the unraid command.
1956+
delete: Optional[:class:`Delete`]
1957+
Metadata associated with the delete command.
1958+
automod_terms: Optional[:class:`AutoModTerms`]
1959+
Metadata associated with the automod terms changes.
1960+
unban_request: Optional[:class:`UnBanRequest`]
1961+
Metadata associated with an unban request.
19321962
"""
19331963

19341964
__slots__ = (
@@ -1953,63 +1983,165 @@ class ChannelModerateData(EventData):
19531983
)
19541984

19551985
class Followers:
1986+
"""
1987+
Metadata associated with the followers command.
1988+
1989+
Attributes:
1990+
-----------
1991+
follow_duration_minutes: :class:`int`
1992+
The length of time, in minutes, that the followers must have followed the broadcaster to participate in the chat room.
1993+
"""
1994+
19561995
def __init__(self, data: dict) -> None:
19571996
self.follow_duration_minutes: int = data["follow_duration_minutes"]
19581997

19591998
class Slow:
1999+
"""
2000+
Metadata associated with the slow command.
2001+
2002+
Attributes:
2003+
-----------
2004+
wait_time_seconds: :class:`int`
2005+
The amount of time, in seconds, that users need to wait between sending messages.
2006+
"""
2007+
19602008
def __init__(self, data: dict) -> None:
19612009
self.wait_time_seconds: int = data["wait_time_seconds"]
19622010

19632011
class VIPStatus:
2012+
"""
2013+
Metadata associated with the vip / unvip command.
2014+
2015+
Attributes:
2016+
-----------
2017+
user: :class:`PartialUser`
2018+
The user who is gaining or losing VIP access.
2019+
"""
2020+
19642021
def __init__(self, client: EventSubClient, data: dict) -> None:
19652022
self.user: PartialUser = _transform_user(client, data, "user")
19662023

19672024
class ModeratorStatus:
2025+
"""
2026+
Metadata associated with the mod / unmod command.
2027+
2028+
Attributes:
2029+
-----------
2030+
user: :class:`PartialUser`
2031+
The user who is gaining or losing moderator access.
2032+
"""
2033+
19682034
def __init__(self, client: EventSubClient, data: dict) -> None:
19692035
self.user: PartialUser = _transform_user(client, data, "user")
19702036

1971-
class Ban:
2037+
class BanStatus:
2038+
"""
2039+
Metadata associated with the ban / unban command.
2040+
2041+
Attributes:
2042+
-----------
2043+
user: :class:`PartialUser`
2044+
The user who is banned / unbanned.
2045+
reason: Optional[:class:`str`]
2046+
Reason for the ban.
2047+
"""
2048+
19722049
def __init__(self, client: EventSubClient, data: dict) -> None:
19732050
self.user: PartialUser = _transform_user(client, data, "user")
19742051
self.reason: Optional[str] = data.get("reason")
19752052

1976-
class UnBan:
1977-
def __init__(self, client: EventSubClient, data: dict) -> None:
1978-
self.user: PartialUser = _transform_user(client, data, "user")
2053+
class TimeoutStatus:
2054+
"""
2055+
Metadata associated with the timeout / untimeout command.
2056+
2057+
Attributes:
2058+
-----------
2059+
user: :class:`PartialUser`
2060+
The user who is timedout / untimedout.
2061+
reason: Optional[:class:`str`]
2062+
Reason for the timeout.
2063+
expires_at: Optional[:class:`datetime.datetime`]
2064+
Datetime the timeout expires.
2065+
"""
19792066

1980-
class Timeout:
19812067
def __init__(self, client: EventSubClient, data: dict) -> None:
19822068
self.user: PartialUser = _transform_user(client, data, "user")
19832069
self.reason: Optional[str] = data.get("reason")
1984-
self.expires_at: datetime.datetime = _parse_datetime(data["expires_at"])
2070+
self.expires_at: Optional[datetime.datetime] = (
2071+
_parse_datetime(data["expires_at"]) if data.get("expires_at") is not None else None
2072+
)
19852073

1986-
class UnTimeout:
1987-
def __init__(self, client: EventSubClient, data: dict) -> None:
1988-
self.user: PartialUser = _transform_user(client, data, "user")
2074+
class RaidStatus:
2075+
"""
2076+
Metadata associated with the raid / unraid command.
2077+
2078+
Attributes:
2079+
-----------
2080+
user: :class:`PartialUser`
2081+
The user who is timedout / untimedout.
2082+
viewer_count: :class:`int`
2083+
The viewer count.
2084+
"""
19892085

1990-
class Raid:
19912086
def __init__(self, client: EventSubClient, data: dict) -> None:
19922087
self.user: PartialUser = _transform_user(client, data, "user")
19932088
self.viewer_count: int = data["viewer_count"]
19942089

1995-
class UnRaid:
1996-
def __init__(self, client: EventSubClient, data: dict) -> None:
1997-
self.user: PartialUser = _transform_user(client, data, "user")
1998-
19992090
class Delete:
2091+
"""
2092+
Metadata associated with the delete command.
2093+
2094+
Attributes:
2095+
-----------
2096+
user: :class:`PartialUser`
2097+
The user who is timedout / untimedout.
2098+
message_id: :class:`str`
2099+
The id of deleted message.
2100+
message_body: :class:`str`
2101+
The message body of the deleted message.
2102+
"""
2103+
20002104
def __init__(self, client: EventSubClient, data: dict) -> None:
20012105
self.user: PartialUser = _transform_user(client, data, "user")
20022106
self.message_id: str = data["message_id"]
20032107
self.message_body: str = data["message_body"]
20042108

20052109
class AutoModTerms:
2110+
"""
2111+
Metadata associated with the automod terms change.
2112+
2113+
Attributes:
2114+
-----------
2115+
action: :class:`Literal["add", "remove"]`
2116+
Either “add” or “remove”.
2117+
list: :class:`Literal["blocked", "permitted"]`
2118+
Either “blocked” or “permitted”.
2119+
terms: List[:class:`str`]
2120+
Terms being added or removed.
2121+
from_automod: :class:`bool`
2122+
Whether the terms were added due to an Automod message approve/deny action.
2123+
"""
2124+
20062125
def __init__(self, data: dict) -> None:
2007-
self.action: str = data["action"]
2008-
self.list: str = data["list"]
2126+
self.action: Literal["add", "remove"] = data["action"]
2127+
self.list: Literal["blocked", "permitted"] = data["list"]
20092128
self.terms: List[str] = data["terms"]
20102129
self.from_automod: bool = data["from_automod"]
20112130

20122131
class UnBanRequest:
2132+
"""
2133+
Metadata associated with the slow command.
2134+
2135+
Attributes:
2136+
-----------
2137+
user: :class:`PartialUser`
2138+
The user who is requesting an unban.
2139+
is_approved: :class:`bool`
2140+
Whether or not the unban request was approved or denied.
2141+
moderator_message: :class:`str`
2142+
The message included by the moderator explaining their approval or denial.
2143+
"""
2144+
20132145
def __init__(self, client: EventSubClient, data: dict) -> None:
20142146
self.user: PartialUser = _transform_user(client, data, "user")
20152147
self.is_approved: bool = data["is_approved"]
@@ -2025,12 +2157,12 @@ def __init__(self, client: EventSubClient, data: dict) -> None:
20252157
self.unvip = self.VIPStatus(client, data["unvip"]) if data.get("unvip") is not None else None
20262158
self.mod = self.ModeratorStatus(client, data["mod"]) if data.get("mod") is not None else None
20272159
self.unmod = self.ModeratorStatus(client, data["unmod"]) if data.get("unmod") is not None else None
2028-
self.ban = self.Ban(client, data["ban"]) if data.get("ban") is not None else None
2029-
self.unban = self.UnBan(client, data["unban"]) if data.get("unban") is not None else None
2030-
self.timeout = self.Timeout(client, data["timeout"]) if data.get("timeout") is not None else None
2031-
self.untimeout = self.UnTimeout(client, data["untimeout"]) if data.get("untimeout") is not None else None
2032-
self.raid = self.Raid(client, data["raid"]) if data.get("raid") is not None else None
2033-
self.unraid = self.UnRaid(client, data["unraid"]) if data.get("unraid") is not None else None
2160+
self.ban = self.BanStatus(client, data["ban"]) if data.get("ban") is not None else None
2161+
self.unban = self.BanStatus(client, data["unban"]) if data.get("unban") is not None else None
2162+
self.timeout = self.TimeoutStatus(client, data["timeout"]) if data.get("timeout") is not None else None
2163+
self.untimeout = self.TimeoutStatus(client, data["untimeout"]) if data.get("untimeout") is not None else None
2164+
self.raid = self.RaidStatus(client, data["raid"]) if data.get("raid") is not None else None
2165+
self.unraid = self.RaidStatus(client, data["unraid"]) if data.get("unraid") is not None else None
20342166
self.delete = self.Delete(client, data["delete"]) if data.get("delete") is not None else None
20352167
self.automod_terms = (
20362168
self.AutoModTerms(client, data["automod_terms"]) if data.get("automod_terms") is not None else None

0 commit comments

Comments
 (0)