twitch.py 3.2.1__tar.gz → 3.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {twitch_py-3.2.1/twitch.py.egg-info → twitch_py-3.2.2}/PKG-INFO +12 -7
- {twitch_py-3.2.1 → twitch_py-3.2.2}/README.md +11 -6
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/__init__.py +1 -1
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/client.py +38 -13
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/ext/bot/bot.py +36 -10
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/types/eventsub/activity.py +11 -4
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/types/eventsub/channels.py +0 -1
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/types/eventsub/chat.py +114 -50
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/types/eventsub/interaction.py +18 -13
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/types/eventsub/moderation.py +17 -21
- {twitch_py-3.2.1 → twitch_py-3.2.2/twitch.py.egg-info}/PKG-INFO +12 -7
- {twitch_py-3.2.1 → twitch_py-3.2.2}/LICENSE +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/MANIFEST.in +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/pyproject.toml +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/requirements.txt +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/setup.cfg +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/setup.py +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/channel.py +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/chat.py +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/errors.py +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/ext/bot/__init__.py +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/ext/oauth/__init__.py +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/ext/oauth/enums.py +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/ext/oauth/http.py +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/ext/oauth/oauth.py +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/gateway.py +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/http.py +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/py.typed +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/state.py +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/stream.py +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/types/__init__.py +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/types/activity.py +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/types/analytics.py +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/types/bits.py +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/types/channels.py +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/types/chat.py +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/types/eventsub/__init__.py +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/types/eventsub/bits.py +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/types/eventsub/streams.py +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/types/eventsub/users.py +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/types/interaction.py +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/types/moderation.py +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/types/search.py +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/types/streams.py +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/types/users.py +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/user.py +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch/utils.py +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch.py.egg-info/SOURCES.txt +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch.py.egg-info/dependency_links.txt +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch.py.egg-info/requires.txt +0 -0
- {twitch_py-3.2.1 → twitch_py-3.2.2}/twitch.py.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: twitch.py
|
|
3
|
-
Version: 3.2.
|
|
3
|
+
Version: 3.2.2
|
|
4
4
|
Summary: Real-time Twitch Event Handling and Helix API Integration in Python
|
|
5
5
|
Author-email: Snifo <Snifo@mail.com>
|
|
6
6
|
License: MIT
|
|
@@ -28,21 +28,26 @@ Requires-Dist: aiohttp>=3.8.0
|
|
|
28
28
|
|
|
29
29
|
# twitch.py
|
|
30
30
|
|
|
31
|
-
[](https://pypi.org/project/twitch.py)
|
|
31
|
+
[](https://pypi.org/project/twitch.py)
|
|
32
|
+
[](https://pypi.org/project/twitch.py)
|
|
32
33
|
|
|
33
34
|
A Python wrapper for Twitch It handles real-time events via WebSocket EventSub and integrates with the Helix API,
|
|
34
35
|
all designed for easy asynchronous use.
|
|
35
36
|
|
|
36
37
|
## Installation
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
To install **twitch.py**, use the appropriate command for your operating system:
|
|
40
|
+
|
|
41
|
+
For Windows:
|
|
39
42
|
|
|
40
43
|
```bash
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
py -3 -m pip install --upgrade twitch.py
|
|
45
|
+
```
|
|
43
46
|
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
For macOS/Linux:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
python3 -m pip install --upgrade twitch.py
|
|
46
51
|
```
|
|
47
52
|
|
|
48
53
|
## Quick Start
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
# twitch.py
|
|
2
2
|
|
|
3
|
-
[](https://pypi.org/project/twitch.py)
|
|
3
|
+
[](https://pypi.org/project/twitch.py)
|
|
4
|
+
[](https://pypi.org/project/twitch.py)
|
|
4
5
|
|
|
5
6
|
A Python wrapper for Twitch It handles real-time events via WebSocket EventSub and integrates with the Helix API,
|
|
6
7
|
all designed for easy asynchronous use.
|
|
7
8
|
|
|
8
9
|
## Installation
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
To install **twitch.py**, use the appropriate command for your operating system:
|
|
12
|
+
|
|
13
|
+
For Windows:
|
|
11
14
|
|
|
12
15
|
```bash
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
py -3 -m pip install --upgrade twitch.py
|
|
17
|
+
```
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
For macOS/Linux:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
python3 -m pip install --upgrade twitch.py
|
|
18
23
|
```
|
|
19
24
|
|
|
20
25
|
## Quick Start
|
|
@@ -51,9 +51,9 @@ class Client:
|
|
|
51
51
|
"""
|
|
52
52
|
A client for interacting with the Twitch API.
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
The Client class enables interaction with the Twitch API. After authentication,
|
|
55
|
+
it manages HTTP requests and WebSocket connections for real-time updates,
|
|
56
|
+
providing access to a broad range of Helix API endpoints.
|
|
57
57
|
|
|
58
58
|
Parameters
|
|
59
59
|
----------
|
|
@@ -63,17 +63,42 @@ class Client:
|
|
|
63
63
|
The client secret used for authentication with the Twitch API. Default is None.
|
|
64
64
|
**options:
|
|
65
65
|
Additional configuration options:
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
|
|
67
|
+
- cli: [bool][bool]
|
|
68
|
+
|
|
69
|
+
Flag indicating if CLI mode is enabled.
|
|
70
|
+
|
|
71
|
+
**Default**: `False`
|
|
72
|
+
|
|
73
|
+
___
|
|
74
|
+
|
|
75
|
+
- cli_port: [int][]
|
|
76
|
+
|
|
77
|
+
The port number used for CLI mode.
|
|
78
|
+
|
|
79
|
+
**Default**: `8080`
|
|
80
|
+
___
|
|
81
|
+
|
|
82
|
+
- socket_debug: `False`
|
|
83
|
+
|
|
71
84
|
Flag indicating if raw WebSocket messages should be dispatched for debugging purposes.
|
|
72
|
-
If enabled, raw WebSocket messages are dispatched to the
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
85
|
+
If enabled, raw WebSocket messages are dispatched to the on_socket_raw_receive.
|
|
86
|
+
|
|
87
|
+
**Default**: `False`
|
|
88
|
+
___
|
|
89
|
+
|
|
90
|
+
- proxy: [Optional][typing.Optional][[str][str]]
|
|
91
|
+
|
|
92
|
+
The proxy URL to use for HTTP requests.
|
|
93
|
+
|
|
94
|
+
**Default**: `None`
|
|
95
|
+
___
|
|
96
|
+
|
|
97
|
+
- proxy_auth: [Optional][typing.Optional][aiohttp.BasicAuth]
|
|
98
|
+
|
|
99
|
+
Authentication details for the proxy, if required.
|
|
100
|
+
|
|
101
|
+
**Default**: `None`
|
|
77
102
|
"""
|
|
78
103
|
|
|
79
104
|
def __init__(self, client_id: str, client_secret: Optional[str] = None, **options) -> None:
|
|
@@ -53,16 +53,42 @@ class Bot(twitch.Client):
|
|
|
53
53
|
The client secret used for authentication. Default is None.
|
|
54
54
|
**options:
|
|
55
55
|
Additional configuration options:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
56
|
+
|
|
57
|
+
- cli: [bool][bool]
|
|
58
|
+
|
|
59
|
+
Flag indicating if CLI mode is enabled.
|
|
60
|
+
|
|
61
|
+
**Default**: `False`
|
|
62
|
+
|
|
63
|
+
___
|
|
64
|
+
|
|
65
|
+
- cli_port: [int][]
|
|
66
|
+
|
|
67
|
+
The port number used for CLI mode.
|
|
68
|
+
|
|
69
|
+
**Default**: `8080`
|
|
70
|
+
___
|
|
71
|
+
|
|
72
|
+
- socket_debug: `False`
|
|
73
|
+
|
|
74
|
+
Flag indicating if raw WebSocket messages should be dispatched for debugging purposes.
|
|
75
|
+
If enabled, raw WebSocket messages are dispatched to the on_socket_raw_receive.
|
|
76
|
+
|
|
77
|
+
**Default**: `False`
|
|
78
|
+
___
|
|
79
|
+
|
|
80
|
+
- proxy: [Optional][typing.Optional][[str][str]]
|
|
81
|
+
|
|
82
|
+
The proxy URL to use for HTTP requests.
|
|
83
|
+
|
|
84
|
+
**Default**: `None`
|
|
85
|
+
___
|
|
86
|
+
|
|
87
|
+
- proxy_auth: [Optional][typing.Optional][aiohttp.BasicAuth]
|
|
88
|
+
|
|
89
|
+
Authentication details for the proxy, if required.
|
|
90
|
+
|
|
91
|
+
**Default**: `None`
|
|
66
92
|
"""
|
|
67
93
|
def __init__(self, client_id: str, client_secret: Optional[str] = None, **options) -> None:
|
|
68
94
|
super().__init__(client_id=client_id, client_secret=client_secret, **options)
|
|
@@ -28,7 +28,7 @@ from .users import SpecificBroadcaster, Broadcaster, SpecificUser
|
|
|
28
28
|
from typing import TYPE_CHECKING, TypedDict
|
|
29
29
|
|
|
30
30
|
if TYPE_CHECKING:
|
|
31
|
-
from typing import
|
|
31
|
+
from typing import Literal
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
class DonationAmount(TypedDict):
|
|
@@ -183,9 +183,16 @@ class GoalsEvent(SpecificBroadcaster):
|
|
|
183
183
|
----------
|
|
184
184
|
id: str
|
|
185
185
|
The unique identifier for the goal event.
|
|
186
|
-
type:
|
|
187
|
-
|
|
188
|
-
|
|
186
|
+
type: str
|
|
187
|
+
The type of goal being tracked. Possible values include:
|
|
188
|
+
|
|
189
|
+
- follow
|
|
190
|
+
- subscription
|
|
191
|
+
- subscription_count
|
|
192
|
+
- new_subscription
|
|
193
|
+
- new_subscription_count
|
|
194
|
+
- new_bit
|
|
195
|
+
- new_cheerer
|
|
189
196
|
description: str
|
|
190
197
|
A description of the goal event.
|
|
191
198
|
is_achieved: bool
|
|
@@ -28,7 +28,7 @@ from .users import SpecificBroadcaster, SpecificUser
|
|
|
28
28
|
from typing import TYPE_CHECKING, TypedDict
|
|
29
29
|
|
|
30
30
|
if TYPE_CHECKING:
|
|
31
|
-
from typing import Literal, Optional, List
|
|
31
|
+
from typing import Literal, Optional, List
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
# Message
|
|
@@ -233,30 +233,49 @@ class MessageEvent(SpecificBroadcaster):
|
|
|
233
233
|
chatter_user_login: str
|
|
234
234
|
The login name of the user who sent the message.
|
|
235
235
|
message_id: str
|
|
236
|
-
|
|
236
|
+
A UUID that identifies the message.
|
|
237
237
|
message: Message
|
|
238
|
-
The message content.
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
238
|
+
The structured chat message content.
|
|
239
|
+
- text: str
|
|
240
|
+
The plain text of the message.
|
|
241
|
+
- fragments: List[Fragment]
|
|
242
|
+
An ordered list of message fragments (e.g., text, cheermotes, emotes, mentions).
|
|
243
|
+
message_type: str
|
|
244
|
+
The type of the message. Possible values include:
|
|
245
|
+
|
|
246
|
+
- text
|
|
247
|
+
- channel_points_highlighted
|
|
248
|
+
- channel_points_sub_only
|
|
249
|
+
- user_intro
|
|
250
|
+
- power_ups_message_effect
|
|
251
|
+
- power_ups_gigantified_emote
|
|
248
252
|
badges: List[Badge]
|
|
249
253
|
A list of badges associated with the user.
|
|
250
254
|
cheer: Optional[Cheer]
|
|
251
|
-
|
|
255
|
+
Metadata if the message includes a cheer.
|
|
252
256
|
color: Optional[str]
|
|
253
|
-
The color of the user's chat message.
|
|
257
|
+
The color of the user's chat message, in hexadecimal RGB format (e.g., "#FF0000").
|
|
254
258
|
reply: Optional[Reply]
|
|
255
|
-
Details of
|
|
259
|
+
Details of a reply to a message, if applicable.
|
|
256
260
|
channel_points_custom_reward_id: Optional[str]
|
|
257
261
|
The ID of the custom reward associated with the message, if applicable.
|
|
258
262
|
channel_points_animation_id: Optional[str]
|
|
259
263
|
The ID of the animation associated with the channel points reward, if applicable.
|
|
264
|
+
source_broadcaster_user_id: Optional[str]
|
|
265
|
+
The broadcaster user ID of the channel the message was sent from,
|
|
266
|
+
in case of a shared chat session.
|
|
267
|
+
source_broadcaster_user_name: Optional[str]
|
|
268
|
+
The user name of the broadcaster of the channel the message was sent from,
|
|
269
|
+
in case of a shared chat session.
|
|
270
|
+
source_broadcaster_user_login: Optional[str]
|
|
271
|
+
The login of the broadcaster of the channel the message was sent from,
|
|
272
|
+
in case of a shared chat session.
|
|
273
|
+
source_message_id: Optional[str]
|
|
274
|
+
The UUID that identifies the source message from the channel it was sent from,
|
|
275
|
+
in case of a shared chat session.
|
|
276
|
+
source_badges: Optional[List[Badge]]
|
|
277
|
+
The list of chat badges for the chatter in the channel the message was sent from,
|
|
278
|
+
in case of a shared chat session.
|
|
260
279
|
"""
|
|
261
280
|
chatter_user_id: str
|
|
262
281
|
chatter_user_name: str
|
|
@@ -277,6 +296,11 @@ class MessageEvent(SpecificBroadcaster):
|
|
|
277
296
|
reply: Optional[Reply]
|
|
278
297
|
channel_points_custom_reward_id: Optional[str]
|
|
279
298
|
channel_points_animation_id: Optional[str]
|
|
299
|
+
source_broadcaster_user_id: Optional[str]
|
|
300
|
+
source_broadcaster_user_name: Optional[str]
|
|
301
|
+
source_broadcaster_user_login: Optional[str]
|
|
302
|
+
source_message_id: Optional[str]
|
|
303
|
+
source_badges: Optional[List[Badge]]
|
|
280
304
|
|
|
281
305
|
|
|
282
306
|
class MessageDeleteEvent(SpecificBroadcaster):
|
|
@@ -544,73 +568,99 @@ class BitsBadgeTier(TypedDict):
|
|
|
544
568
|
tier: int
|
|
545
569
|
|
|
546
570
|
|
|
547
|
-
class NotificationEvent(
|
|
571
|
+
class NotificationEvent(SpecificBroadcaster):
|
|
548
572
|
"""
|
|
549
573
|
Represents a notification event.
|
|
550
574
|
|
|
551
575
|
Attributes
|
|
552
576
|
----------
|
|
553
577
|
broadcaster_user_id: str
|
|
554
|
-
|
|
578
|
+
ID of the broadcaster.
|
|
555
579
|
broadcaster_user_name: str
|
|
556
|
-
|
|
580
|
+
Name of the broadcaster.
|
|
557
581
|
broadcaster_user_login: str
|
|
558
|
-
|
|
582
|
+
Login of the broadcaster.
|
|
559
583
|
chatter_user_id: str
|
|
560
|
-
|
|
584
|
+
ID of the chatter.
|
|
561
585
|
chatter_user_name: str
|
|
562
|
-
|
|
586
|
+
Name of the chatter.
|
|
563
587
|
chatter_user_login: str
|
|
564
|
-
|
|
588
|
+
Login of the chatter.
|
|
565
589
|
chatter_is_anonymous: bool
|
|
566
590
|
Whether the chatter is anonymous.
|
|
567
591
|
color: str
|
|
568
|
-
|
|
592
|
+
Color of the notification.
|
|
569
593
|
badges: List[Badge]
|
|
570
|
-
|
|
571
|
-
system_message: str
|
|
572
|
-
|
|
594
|
+
Badges associated with the chatter.
|
|
595
|
+
system_message: Optional[str]
|
|
596
|
+
System message of the notification.
|
|
573
597
|
message_id: str
|
|
574
|
-
|
|
598
|
+
ID of the message.
|
|
575
599
|
message: Message
|
|
576
|
-
|
|
600
|
+
Content of the message.
|
|
577
601
|
notice_type: str
|
|
578
|
-
|
|
602
|
+
Type of the notification.
|
|
579
603
|
sub: Optional[Sub]
|
|
580
|
-
|
|
604
|
+
Subscription details, if applicable.
|
|
581
605
|
resub: Optional[Resub]
|
|
582
|
-
|
|
606
|
+
Resubscription details, if applicable.
|
|
583
607
|
sub_gift: Optional[SubGift]
|
|
584
|
-
|
|
608
|
+
Subscription gift details, if applicable.
|
|
585
609
|
community_sub_gift: Optional[CommunitySubGift]
|
|
586
|
-
|
|
610
|
+
Community subscription gift details, if applicable.
|
|
587
611
|
gift_paid_upgrade: Optional[GiftPaidUpgrade]
|
|
588
|
-
|
|
612
|
+
Paid upgrade for a gifted subscription, if applicable.
|
|
589
613
|
prime_paid_upgrade: Optional[PrimePaidUpgrade]
|
|
590
|
-
|
|
614
|
+
Paid upgrade for a Prime subscription, if applicable.
|
|
591
615
|
raid: Optional[Raid]
|
|
592
|
-
|
|
593
|
-
unraid: Optional[
|
|
594
|
-
|
|
616
|
+
Raid event details, if applicable.
|
|
617
|
+
unraid: Optional[SpecificUser]
|
|
618
|
+
Unraid event details, if applicable.
|
|
595
619
|
pay_it_forward: Optional[PayItForward]
|
|
596
|
-
|
|
620
|
+
Pay It Forward event details, if applicable.
|
|
597
621
|
announcement: Optional[Announcement]
|
|
598
|
-
|
|
622
|
+
Announcement details, if applicable.
|
|
599
623
|
charity_donation: Optional[CharityDonation]
|
|
600
|
-
|
|
624
|
+
Charity donation details, if applicable.
|
|
601
625
|
bits_badge_tier: Optional[BitsBadgeTier]
|
|
602
|
-
|
|
626
|
+
Bits badge tier details, if applicable.
|
|
627
|
+
source_broadcaster_user_id: Optional[str]
|
|
628
|
+
ID of the source broadcaster, if different.
|
|
629
|
+
source_broadcaster_user_name: Optional[str]
|
|
630
|
+
Name of the source broadcaster, if different.
|
|
631
|
+
source_broadcaster_user_login: Optional[str]
|
|
632
|
+
Login of the source broadcaster, if different.
|
|
633
|
+
source_message_id: Optional[str]
|
|
634
|
+
ID of the source message, if different.
|
|
635
|
+
source_badges: Optional[List[Badge]]
|
|
636
|
+
Badges for the source chatter, if different.
|
|
637
|
+
shared_chat_sub: Optional[Sub]
|
|
638
|
+
Shared chat subscription details, if applicable.
|
|
639
|
+
shared_chat_resub: Optional[Resub]
|
|
640
|
+
Shared chat re-subscription details, if applicable.
|
|
641
|
+
shared_chat_sub_gift: Optional[SubGift]
|
|
642
|
+
Shared chat subscription gift details, if applicable.
|
|
643
|
+
shared_chat_community_sub_gift: Optional[CommunitySubGift]
|
|
644
|
+
Shared chat community subscription gift details, if applicable.
|
|
645
|
+
shared_chat_gift_paid_upgrade: Optional[GiftPaidUpgrade]
|
|
646
|
+
Shared chat paid upgrade for a gifted subscription, if applicable.
|
|
647
|
+
shared_chat_prime_paid_upgrade: Optional[PrimePaidUpgrade]
|
|
648
|
+
Shared chat paid upgrade for a Prime subscription, if applicable.
|
|
649
|
+
shared_chat_pay_it_forward: Optional[PayItForward]
|
|
650
|
+
Shared chat Pay It Forward event details, if applicable.
|
|
651
|
+
shared_chat_raid: Optional[Raid]
|
|
652
|
+
Shared chat raid event details, if applicable.
|
|
653
|
+
shared_chat_announcement: Optional[Announcement]
|
|
654
|
+
Shared chat announcement details, if applicable.
|
|
603
655
|
"""
|
|
604
|
-
|
|
605
|
-
broadcaster_user_name: str
|
|
606
|
-
broadcaster_user_login: str
|
|
656
|
+
tier: int
|
|
607
657
|
chatter_user_id: str
|
|
608
658
|
chatter_user_name: str
|
|
609
659
|
chatter_user_login: str
|
|
610
660
|
chatter_is_anonymous: bool
|
|
611
661
|
color: str
|
|
612
662
|
badges: List[Badge]
|
|
613
|
-
system_message: str
|
|
663
|
+
system_message: Optional[str]
|
|
614
664
|
message_id: str
|
|
615
665
|
message: Message
|
|
616
666
|
notice_type: str
|
|
@@ -620,12 +670,26 @@ class NotificationEvent(TypedDict):
|
|
|
620
670
|
community_sub_gift: Optional[CommunitySubGift]
|
|
621
671
|
gift_paid_upgrade: Optional[GiftPaidUpgrade]
|
|
622
672
|
prime_paid_upgrade: Optional[PrimePaidUpgrade]
|
|
623
|
-
raid: Optional[Raid]
|
|
624
|
-
unraid: Optional[Dict[Any, Any]]
|
|
625
673
|
pay_it_forward: Optional[PayItForward]
|
|
674
|
+
raid: Optional[Raid]
|
|
675
|
+
unraid: Optional[SpecificUser]
|
|
626
676
|
announcement: Optional[Announcement]
|
|
627
|
-
charity_donation: Optional[CharityDonation]
|
|
628
677
|
bits_badge_tier: Optional[BitsBadgeTier]
|
|
678
|
+
charity_donation: Optional[CharityDonation]
|
|
679
|
+
source_broadcaster_user_id: Optional[str]
|
|
680
|
+
source_broadcaster_user_name: Optional[str]
|
|
681
|
+
source_broadcaster_user_login: Optional[str]
|
|
682
|
+
source_message_id: Optional[str]
|
|
683
|
+
source_badges: Optional[List[Badge]]
|
|
684
|
+
shared_chat_sub: Optional[Sub]
|
|
685
|
+
shared_chat_resub: Optional[Resub]
|
|
686
|
+
shared_chat_sub_gift: Optional[SubGift]
|
|
687
|
+
shared_chat_community_sub_gift: Optional[CommunitySubGift]
|
|
688
|
+
shared_chat_gift_paid_upgrade: Optional[GiftPaidUpgrade]
|
|
689
|
+
shared_chat_prime_paid_upgrade: Optional[PrimePaidUpgrade]
|
|
690
|
+
shared_chat_pay_it_forward: Optional[PayItForward]
|
|
691
|
+
shared_chat_raid: Optional[Raid]
|
|
692
|
+
shared_chat_announcement: Optional[Announcement]
|
|
629
693
|
|
|
630
694
|
|
|
631
695
|
# Settings
|
|
@@ -656,4 +720,4 @@ class SettingsUpdateEvent(SpecificBroadcaster):
|
|
|
656
720
|
slow_mode: bool
|
|
657
721
|
slow_mode_wait_time_seconds: Optional[int]
|
|
658
722
|
subscriber_mode: bool
|
|
659
|
-
unique_chat_mode: bool
|
|
723
|
+
unique_chat_mode: bool
|
|
@@ -72,25 +72,30 @@ class AutomaticReward(TypedDict):
|
|
|
72
72
|
|
|
73
73
|
Attributes
|
|
74
74
|
----------
|
|
75
|
-
type:
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
75
|
+
type: str
|
|
76
|
+
The type of event. Possible values include:
|
|
77
|
+
|
|
78
|
+
- single_message_bypass_sub_mode
|
|
79
|
+
- send_highlighted_message
|
|
80
|
+
- random_sub_emote_unlock
|
|
81
|
+
- chosen_sub_emote_unlock
|
|
82
|
+
- chosen_modified_sub_emote_unlock
|
|
83
|
+
- message_effect
|
|
84
|
+
- gigantify_an_emote
|
|
85
|
+
- celebration
|
|
80
86
|
cost: int
|
|
81
87
|
The cost of the reward in channel points or other currency.
|
|
82
88
|
unlocked_emote: Optional[UnlockedEmote]
|
|
83
89
|
Details of an emote unlocked by the reward, if applicable.
|
|
84
90
|
"""
|
|
85
91
|
type: Literal['single_message_bypass_sub_mode',
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
]
|
|
92
|
+
'send_highlighted_message',
|
|
93
|
+
'random_sub_emote_unlock',
|
|
94
|
+
'chosen_sub_emote_unlock',
|
|
95
|
+
'chosen_modified_sub_emote_unlock',
|
|
96
|
+
'message_effect',
|
|
97
|
+
'gigantify_an_emote',
|
|
98
|
+
'celebration']
|
|
94
99
|
cost: int
|
|
95
100
|
unlocked_emote: Optional[UnlockedEmote]
|
|
96
101
|
|
|
@@ -31,7 +31,6 @@ if TYPE_CHECKING:
|
|
|
31
31
|
from typing import List, Optional, Literal
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
|
|
35
34
|
# AutoMod
|
|
36
35
|
class Emote(TypedDict):
|
|
37
36
|
"""
|
|
@@ -123,18 +122,12 @@ class AutomodMessageHoldEvent(SpecificBroadcaster, SpecificUser):
|
|
|
123
122
|
held_at: str
|
|
124
123
|
|
|
125
124
|
|
|
126
|
-
class AutomodMessageUpdateEvent(SpecificBroadcaster, SpecificUser):
|
|
125
|
+
class AutomodMessageUpdateEvent(SpecificBroadcaster, SpecificModerator, SpecificUser):
|
|
127
126
|
"""
|
|
128
127
|
Represents an event where a held message is updated by AutoMod.
|
|
129
128
|
|
|
130
129
|
Attributes
|
|
131
130
|
----------
|
|
132
|
-
moderator_user_id: str
|
|
133
|
-
The user ID of the moderator updating the message.
|
|
134
|
-
moderator_user_login: str
|
|
135
|
-
The login name of the moderator updating the message.
|
|
136
|
-
moderator_user_name: str
|
|
137
|
-
The display name of the moderator updating the message.
|
|
138
131
|
message_id: str
|
|
139
132
|
The ID of the updated message.
|
|
140
133
|
message: Message
|
|
@@ -148,9 +141,6 @@ class AutomodMessageUpdateEvent(SpecificBroadcaster, SpecificUser):
|
|
|
148
141
|
held_at: str
|
|
149
142
|
The timestamp when the message was held, in ISO 8601 format.
|
|
150
143
|
"""
|
|
151
|
-
moderator_user_id: str
|
|
152
|
-
moderator_user_login: str
|
|
153
|
-
moderator_user_name: str
|
|
154
144
|
message_id: str
|
|
155
145
|
message: Message
|
|
156
146
|
category: str
|
|
@@ -317,26 +307,17 @@ class BanMetadata(SpecificUser):
|
|
|
317
307
|
reason: Optional[str]
|
|
318
308
|
|
|
319
309
|
|
|
320
|
-
class TimeoutMetadata(
|
|
310
|
+
class TimeoutMetadata(SpecificUser):
|
|
321
311
|
"""
|
|
322
312
|
Represents metadata related to a timeout.
|
|
323
313
|
|
|
324
314
|
Attributes
|
|
325
315
|
----------
|
|
326
|
-
user_id: str
|
|
327
|
-
The ID of the user who was timed out.
|
|
328
|
-
user_login: str
|
|
329
|
-
The login name of the user who was timed out.
|
|
330
|
-
user_name: str
|
|
331
|
-
The display name of the user who was timed out.
|
|
332
316
|
reason: Optional[str]
|
|
333
317
|
The reason for the timeout, if provided.
|
|
334
318
|
expires_at: Optional[str]
|
|
335
319
|
The timestamp when the timeout will end, in ISO 8601 format.
|
|
336
320
|
"""
|
|
337
|
-
user_id: str
|
|
338
|
-
user_login: str
|
|
339
|
-
user_name: str
|
|
340
321
|
reason: Optional[str]
|
|
341
322
|
expires_at: Optional[str]
|
|
342
323
|
|
|
@@ -459,6 +440,16 @@ class ModerateEvent(SpecificBroadcaster, SpecificModerator):
|
|
|
459
440
|
Metadata related to an unban request, if applicable.
|
|
460
441
|
warn: Optional[WarnMetadata]
|
|
461
442
|
Metadata related to a warning, if applicable.
|
|
443
|
+
shared_chat_ban: Optional[BanMetadata]
|
|
444
|
+
Information about the shared_chat_ban event, if applicable.
|
|
445
|
+
shared_chat_unban: Optional[SpecificUser]
|
|
446
|
+
Information about the shared_chat_unban event, if applicable.
|
|
447
|
+
shared_chat_timeout: Optional[TimeoutMetadata]
|
|
448
|
+
Information about the shared_chat_timeout event, if applicable.
|
|
449
|
+
shared_chat_untimeout: Optional[SpecificUser]
|
|
450
|
+
Information about the shared_chat_untimeout event, if applicable.
|
|
451
|
+
shared_chat_delete: Optional[DeleteMetadata]
|
|
452
|
+
Information about the shared_chat_delete event, if applicable.
|
|
462
453
|
"""
|
|
463
454
|
action: str
|
|
464
455
|
followers: Optional[FollowersMetadata]
|
|
@@ -477,6 +468,11 @@ class ModerateEvent(SpecificBroadcaster, SpecificModerator):
|
|
|
477
468
|
automod_terms: Optional[AutomodTermsMetadata]
|
|
478
469
|
unban_request: Optional[UnbanRequestMetadata]
|
|
479
470
|
warn: Optional[WarnMetadata]
|
|
471
|
+
shared_chat_ban: Optional[BanMetadata]
|
|
472
|
+
shared_chat_unban: Optional[SpecificUser]
|
|
473
|
+
shared_chat_timeout: Optional[TimeoutMetadata]
|
|
474
|
+
shared_chat_untimeout: Optional[SpecificUser]
|
|
475
|
+
shared_chat_delete: Optional[DeleteMetadata]
|
|
480
476
|
|
|
481
477
|
|
|
482
478
|
# Moderator Add/Remove
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: twitch.py
|
|
3
|
-
Version: 3.2.
|
|
3
|
+
Version: 3.2.2
|
|
4
4
|
Summary: Real-time Twitch Event Handling and Helix API Integration in Python
|
|
5
5
|
Author-email: Snifo <Snifo@mail.com>
|
|
6
6
|
License: MIT
|
|
@@ -28,21 +28,26 @@ Requires-Dist: aiohttp>=3.8.0
|
|
|
28
28
|
|
|
29
29
|
# twitch.py
|
|
30
30
|
|
|
31
|
-
[](https://pypi.org/project/twitch.py)
|
|
31
|
+
[](https://pypi.org/project/twitch.py)
|
|
32
|
+
[](https://pypi.org/project/twitch.py)
|
|
32
33
|
|
|
33
34
|
A Python wrapper for Twitch It handles real-time events via WebSocket EventSub and integrates with the Helix API,
|
|
34
35
|
all designed for easy asynchronous use.
|
|
35
36
|
|
|
36
37
|
## Installation
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
To install **twitch.py**, use the appropriate command for your operating system:
|
|
40
|
+
|
|
41
|
+
For Windows:
|
|
39
42
|
|
|
40
43
|
```bash
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
py -3 -m pip install --upgrade twitch.py
|
|
45
|
+
```
|
|
43
46
|
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
For macOS/Linux:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
python3 -m pip install --upgrade twitch.py
|
|
46
51
|
```
|
|
47
52
|
|
|
48
53
|
## Quick Start
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|