@@ -159,7 +159,7 @@ class Attachment(Hashable):
159
159
case of images. When the message is deleted, this URL might be valid for a few
160
160
minutes or not valid at all.
161
161
content_type: Optional[:class:`str`]
162
- The attachment's `media type <https://en.wikipedia.org/wiki/Media_type>`_
162
+ The attachment's `media type <https://en.wikipedia.org/wiki/Media_type>`_.
163
163
ephemeral: :class:`bool`
164
164
Whether the attachment is ephemeral or not.
165
165
@@ -169,6 +169,16 @@ class Attachment(Hashable):
169
169
The attachment's description.
170
170
171
171
.. versionadded:: 2.0
172
+
173
+ duration_secs: Optional[:class:`float`]
174
+ The duration of the audio file (currently for voice messages).
175
+
176
+ .. versionadded:: 2.5
177
+
178
+ waveform: Optional[:class:`str`]
179
+ The base64 encoded bytearray representing a sampled waveform (currently for voice messages).
180
+
181
+ .. versionadded:: 2.5
172
182
"""
173
183
174
184
__slots__ = (
@@ -183,6 +193,8 @@ class Attachment(Hashable):
183
193
"content_type" ,
184
194
"ephemeral" ,
185
195
"description" ,
196
+ "duration_secs" ,
197
+ "waveform" ,
186
198
)
187
199
188
200
def __init__ (self , * , data : AttachmentPayload , state : ConnectionState ):
@@ -197,6 +209,8 @@ def __init__(self, *, data: AttachmentPayload, state: ConnectionState):
197
209
self .content_type : str | None = data .get ("content_type" )
198
210
self .ephemeral : bool = data .get ("ephemeral" , False )
199
211
self .description : str | None = data .get ("description" )
212
+ self .duration_secs : float | None = data .get ("duration_secs" )
213
+ self .waveform : str | None = data .get ("waveform" )
200
214
201
215
def is_spoiler (self ) -> bool :
202
216
"""Whether this attachment contains a spoiler."""
0 commit comments