Skip to content

Commit 61043c9

Browse files
committed
Add duration attribute to Clip model
Add duration attribute to Clip model Correct changelog formatting
1 parent fc82522 commit 61043c9

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

docs/changelog.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ Master
66
- Bug fixes
77
- Added ``self.registered_callbacks = {}`` to Bot and :func:`Client.from_client_credentials`
88
- Fixed message content while handling commands in reply messages
9+
- Add duration attribute to :class:`twitchio.Clip`
910

10-
- ext.commands:
11-
- Bug fixes
12-
- Add type conversion for variable positional arguments
11+
- ext.commands
12+
- Bug fixes
13+
- Add type conversion for variable positional arguments
1314

1415
- ext.pubsub
1516
- Bug fixes

twitchio/models.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ class Clip:
200200
When the clip was created.
201201
thumbnail_url: :class:`str`
202202
The url of the clip thumbnail.
203+
duration: :class:`float`
204+
Duration of the Clip in seconds (up to 0.1 precision).
203205
"""
204206

205207
__slots__ = (
@@ -215,6 +217,7 @@ class Clip:
215217
"views",
216218
"created_at",
217219
"thumbnail_url",
220+
"duration",
218221
)
219222

220223
def __init__(self, http: "TwitchHTTP", data: dict):
@@ -230,6 +233,7 @@ def __init__(self, http: "TwitchHTTP", data: dict):
230233
self.views: int = data["view_count"]
231234
self.created_at = parse_timestamp(data["created_at"])
232235
self.thumbnail_url: str = data["thumbnail_url"]
236+
self.duration: float = data["duration"]
233237

234238
def __repr__(self):
235239
return f"<Clip id={self.id} broadcaster={self.broadcaster} creator={self.creator}>"

0 commit comments

Comments
 (0)