Skip to content

Commit cf78d8e

Browse files
committed
fix some nitpicks, change the ws subscribe stuff to async
1 parent 49067d7 commit cf78d8e

File tree

4 files changed

+193
-112
lines changed

4 files changed

+193
-112
lines changed

docs/exts/eventsub.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,32 @@ This is a list of events dispatched by the eventsub ext.
104104
.. note::
105105
You generally won't need to interact with this event. The ext will handle responding to the challenge automatically.
106106

107+
.. function:: event_eventsub_keepalive(event: KeepaliveEvent)
108+
109+
Called when a Twitch sends a keepalive event. You do not need to use this in daily usage.
110+
111+
.. note::
112+
You generally won't need to interact with this event.
113+
114+
.. function:: event_eventsub_reconnect(event: ReconnectEvent)
115+
116+
Called when a Twitch wishes for us to reconnect.
117+
118+
.. note::
119+
You generally won't need to interact with this event. The library will automatically handle reconnecting.
120+
107121
.. function:: event_eventsub_notification_follow(event: ChannelFollowData)
108122

109123
Called when someone creates a follow on a channel you've subscribed to.
110124

125+
.. warning::
126+
Twitch has removed this, please use :func:`event_eventsub_notification_followV2`
127+
128+
129+
.. function:: event_eventsub_notification_followV2(event: ChannelFollowData)
130+
131+
Called when someone creates a follow on a channel you've subscribed to.
132+
111133
.. function:: event_eventsub_notification_subscription(event: ChannelSubscribeData)
112134

113135
Called when someone subscribes to a channel that you've subscribed to.
@@ -235,6 +257,12 @@ API Reference
235257
:members:
236258
:inherited-members:
237259

260+
.. attributetable:: WebsocketHeaders
261+
262+
.. autoclass:: WebsocketHeaders
263+
:members:
264+
:inherited-members:
265+
238266
.. attributetable::: ChannelBanData
239267
240268
.. autoclass:: ChannelBanData

twitchio/ext/eventsub/http.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ async def create_webhook_subscription(
3232

3333
async def create_websocket_subscription(
3434
self, event_type: Tuple[str, int, Type[EventData]], condition: Dict[str, str], session_id: str, token: str
35-
):
35+
) -> dict:
3636
payload = {
3737
"type": event_type[0],
3838
"version": str(event_type[1]),
3939
"condition": condition,
4040
"transport": {"method": "websocket", "session_id": session_id},
4141
}
4242
route = Route("POST", "eventsub/subscriptions", body=payload, token=token)
43-
return await self._http.request(route, paginate=False, full_body=True)
43+
return await self._http.request(route, paginate=False, full_body=True) # type: ignore
4444

4545
async def delete_subscription(self, subscription: Union[str, Subscription]):
4646
if isinstance(subscription, models.Subscription):

twitchio/ext/eventsub/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ class ReconnectEvent(BaseEvent):
236236
A reconnect event. Called by twitch when the websocket needs to be disconnected for maintenance or other reasons
237237
238238
.. note::
239-
These are only dispatched when using :class:`~twitchio.ext.eventsub.EventSubWSClient
239+
These are only dispatched when using :class:`~twitchio.ext.eventsub.EventSubWSClient`
240240
241241
Attributes
242242
-----------
@@ -258,7 +258,7 @@ class KeepAliveEvent(BaseEvent):
258258
A keep-alive event. Called by twitch when no message has been sent for more than ``keepalive_timeout``
259259
260260
.. note::
261-
These are only dispatched when using :class:`~twitchio.ext.eventsub.EventSubWSClient
261+
These are only dispatched when using :class:`~twitchio.ext.eventsub.EventSubWSClient`
262262
263263
"""
264264

0 commit comments

Comments
 (0)