Skip to content

Commit 21918ce

Browse files
author
Eviee Py
committed
Map some eventsub subscriptions to short names
1 parent 2e3be07 commit 21918ce

File tree

1 file changed

+30
-5
lines changed

1 file changed

+30
-5
lines changed

twitchio/eventsub/subscriptions.py

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,26 @@
110110
)
111111

112112

113+
# Short names: Only map names that require shortening...
114+
_SUB_MAPPING: dict[str, str] = {
115+
"channel.ad_break.begin": "ad_break",
116+
"channel.chat.clear_user_messages": "chat_clear_user",
117+
"channel.chat.message": "message", # Sub events?
118+
"channel.chat.message_delete": "message_delete",
119+
"channel.unban_request.create": "unban_request",
120+
"channel.channel_points_automatic_reward_redemption.add": "automatic_redemption_add",
121+
"channel.channel_points_custom_reward.add": "custom_reward_add",
122+
"channel.channel_points_custom_reward.update": "custom_reward_update",
123+
"channel.channel_points_custom_reward.remove": "custom_reward_remove",
124+
"channel.channel_points_custom_reward_redemption.add": "custom_redemption_add",
125+
"channel.channel_points_custom_reward_redemption.update": "custom_redemption_update",
126+
"user.whisper.message": "message_whisper",
127+
"channel.subscribe": "subscription",
128+
"channel.moderate": "mod_action", # Sub events?
129+
"channel.hype_train.begin": "hype_train",
130+
}
131+
132+
113133
class SubscriptionPayload(abc.ABC):
114134
type: ClassVar[Any]
115135
version: ClassVar[Any]
@@ -1240,7 +1260,8 @@ def condition(self) -> Condition:
12401260

12411261

12421262
class ChannelModerateSubscription(SubscriptionPayload):
1243-
"""The ``channel.moderate subscription`` type sends a notification when a moderator performs a moderation action in a channel. Some of these actions affect chatters in other channels during Shared Chat.
1263+
"""The ``channel.moderate`` subscription type sends a notification when a moderator performs a moderation action in a channel.
1264+
Some of these actions affect chatters in other channels during Shared Chat.
12441265
12451266
This is Version 1 of the subscription.
12461267
@@ -1290,7 +1311,8 @@ def condition(self) -> Condition:
12901311

12911312

12921313
class ChannelModerateV2Subscription(SubscriptionPayload):
1293-
"""The ``channel.moderate subscription`` type sends a notification when a moderator performs a moderation action in a channel. Some of these actions affect chatters in other channels during Shared Chat.
1314+
"""The ``channel.moderate`` subscription type sends a notification when a moderator performs a moderation action in a channel.
1315+
Some of these actions affect chatters in other channels during Shared Chat.
12941316
12951317
This is Version 2 of the subscription that includes warnings.
12961318
@@ -2076,7 +2098,8 @@ def condition(self) -> Condition:
20762098

20772099

20782100
class ChannelWarningAcknowledgementSubscription(SubscriptionPayload):
2079-
"""The ``channel.warning.acknowledge`` subscription type sends a notification when a warning is acknowledged by a user. Broadcasters and moderators can see the warning's details.
2101+
"""The ``channel.warning.acknowledge`` subscription type sends a notification when a warning is acknowledged by a user.
2102+
Broadcasters and moderators can see the warning's details.
20802103
20812104
.. important::
20822105
Must have the ``moderator:read:warnings`` or ``moderator:manage:warnings`` scope.
@@ -2116,7 +2139,8 @@ def condition(self) -> Condition:
21162139

21172140

21182141
class ChannelWarningSendSubscription(SubscriptionPayload):
2119-
"""The ``channel.warning.send`` subscription type sends a notification when a warning is sent to a user. Broadcasters and moderators can see the warning's details.
2142+
"""The ``channel.warning.send`` subscription type sends a notification when a warning is sent to a user.
2143+
Broadcasters and moderators can see the warning's details.
21202144
21212145
.. important::
21222146
Must have the ``moderator:read:warnings`` or ``moderator:manage:warnings`` scope.
@@ -2352,7 +2376,8 @@ def condition(self) -> Condition:
23522376

23532377

23542378
class GoalProgressSubscription(SubscriptionPayload):
2355-
"""The ``channel.goal.progress`` subscription type sends a notification when progress is made towards the specified broadcaster's goal. Progress could be positive (added followers) or negative (lost followers).
2379+
"""The ``channel.goal.progress`` subscription type sends a notification when progress is made towards the specified broadcaster's goal.
2380+
Progress could be positive (added followers) or negative (lost followers).
23562381
23572382
.. note::
23582383
It's possible to receive the Progress events before receiving the Begin event.

0 commit comments

Comments
 (0)