Skip to content

Commit eecafda

Browse files
committed
add follows v2, deprecate follows v1
1 parent c20cab8 commit eecafda

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

docs/changelog.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ Master
3434
- Added Shoutout events
3535
- :func:`~twitchio.ext.eventsub.EventSubClient.subscribe_channel_shoutout_create`
3636
- :func:`~twitchio.ext.eventsub.EventSubClient.subscribe_channel_shoutout_receive`
37+
- Added :func:`~twitchio.ext.eventsub.EventSubClient.subscribe_channel_follows_v2`
38+
39+
- Deprecations
40+
- :func:`~twitchio.ext.eventsub.EventSubClient.subscribe_channel_follows`, use :func:`~twitchio.ext.eventsub.EventSubClient.subscribe_channel_follows_v2`
41+
3742

3843
- ext.pubsub
3944
- Bug fixes

docs/exts/eventsub.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Running Eventsub Inside a Commands Bot
6464
self.loop.create_task(esclient.listen(port=4000))
6565
6666
try:
67-
await esclient.subscribe_channel_follows(broadcaster=channel_ID)
67+
await esclient.subscribe_channel_follows_v2(broadcaster=some_channel_ID, moderator=a_channel_mod_ID)
6868
except twitchio.HTTPException:
6969
pass
7070

twitchio/ext/eventsub/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,6 +1476,7 @@ class _SubscriptionTypes(metaclass=_SubTypesMeta):
14761476
_name_map: Dict[str, str]
14771477

14781478
follow = "channel.follow", 1, ChannelFollowData
1479+
followV2 = "channel.follow", 2, ChannelFollowData
14791480
subscription = "channel.subscribe", 1, ChannelSubscribeData
14801481
subscription_end = "channel.subscription.end", 1, ChannelSubscriptionEndData
14811482
subscription_gift = "channel.subscription.gift", 1, ChannelSubscriptionGiftData

twitchio/ext/eventsub/server.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import asyncio
22
import logging
33
import socket
4+
import warnings
45
from typing import Union, Tuple, Type, Optional, Any
56
from collections.abc import Iterable
67

@@ -153,8 +154,18 @@ def subscribe_channel_update(self, broadcaster: Union[PartialUser, str, int]):
153154
return self._subscribe_with_broadcaster(models.SubscriptionTypes.channel_update, broadcaster)
154155

155156
def subscribe_channel_follows(self, broadcaster: Union[PartialUser, str, int]):
157+
"""
158+
.. warning::
159+
This endpoint is deprecated, use :func:`~EventSubClient.subscribe_channel_follows_v2`
160+
161+
"""
162+
warnings.warn("subscribe_channel_follows is deprecated, use subscribe_channel_follows_v2 instead.", DeprecationWarning, 2)
163+
156164
return self._subscribe_with_broadcaster(models.SubscriptionTypes.follow, broadcaster)
157165

166+
def subscribe_channel_follows_v2(self, broadcaster: Union[PartialUser, str, int], moderator: Union[PartialUser, str, int]):
167+
return self._subscribe_with_broadcaster_moderator(models.SubscriptionTypes.followV2, broadcaster, moderator)
168+
158169
def subscribe_channel_moderators_add(self, broadcaster: Union[PartialUser, str, int]):
159170
return self._subscribe_with_broadcaster(models.SubscriptionTypes.channel_moderator_add, broadcaster)
160171

0 commit comments

Comments
 (0)