@@ -156,7 +156,6 @@ async def request(
156
156
for p in multipart :
157
157
form_data .add_field (** p )
158
158
to_send = form_data
159
- print (to_send )
160
159
try :
161
160
async with session .request (
162
161
method ,
@@ -513,18 +512,23 @@ def create_interaction_response(
513
512
"id" : index ,
514
513
"filename" : file .filename ,
515
514
"description" : file .description ,
516
- "waveform" : "37WKcJ6jlLSVnaabsbeip4KPmHJXUUEbExgFJE8J7iNPFggpKQkTNl95dobFqqe2tKubnbSTX3yLVVBFS4iqd4dbKmFvMChwfVRKfWFYWRpLaV9jlYtKWWZde6mtnYiDlGNUgmFAWWdRXGNsf2NBYnNcS1uDjm+qwK2urKe8uKqjZ2KGSjtbLUpTO0iDYSBSg6CzCk1LNDVAZnOAvNiUkLu8r8vPnFw6bXZbbXcn0vUU8q2q38Olyfb0y7OhlnV9u6N4zuAH9uI=" ,
517
- "duration_secs" : 60.0 ,
515
+ "duration_secs" : file .duration_secs ,
516
+ "waveform" : file .waveform ,
517
+ # TODO: Fix content_type
518
+ #"content_type": "audio/mp3",
518
519
}
519
520
)
520
521
form .append (
521
522
{
522
523
"name" : f"files[{ index } ]" ,
523
524
"value" : file .fp ,
524
525
"filename" : file .filename ,
525
- "content_type" : "application/octet-stream" ,
526
+ # TODO: Fix content_type
527
+ #"content_type": "application/octet-stream",
528
+ #"content_type": "audio/mp3",
526
529
}
527
530
)
531
+ payload ["flags" ] = 1 << 13
528
532
payload ["attachments" ] = attachments
529
533
form [0 ]["value" ] = utils ._to_json (payload )
530
534
@@ -631,6 +635,7 @@ def handle_message_parameters(
631
635
allowed_mentions : AllowedMentions | None = MISSING ,
632
636
previous_allowed_mentions : AllowedMentions | None = None ,
633
637
suppress : bool = False ,
638
+ voice_message : bool = False ,
634
639
) -> ExecuteWebhookParameters :
635
640
if files is not MISSING and file is not MISSING :
636
641
raise TypeError ("Cannot mix file and files keyword arguments." )
@@ -661,7 +666,7 @@ def handle_message_parameters(
661
666
if username :
662
667
payload ["username" ] = username
663
668
664
- flags = MessageFlags (suppress_embeds = suppress , ephemeral = ephemeral )
669
+ flags = MessageFlags (suppress_embeds = suppress , ephemeral = ephemeral , is_voice_message = voice_message )
665
670
payload ["flags" ] = flags .value
666
671
667
672
if applied_tags is not MISSING :
@@ -690,15 +695,17 @@ def handle_message_parameters(
690
695
"value" : file .fp ,
691
696
"filename" : file .filename ,
692
697
"content_type" : "application/octet-stream" ,
693
- "waveform" : "37WKcJ6jlLSVnaabsbeip4KPmHJXUUEbExgFJE8J7iNPFggpKQkTNl95dobFqqe2tKubnbSTX3yLVVBFS4iqd4dbKmFvMChwfVRKfWFYWRpLaV9jlYtKWWZde6mtnYiDlGNUgmFAWWdRXGNsf2NBYnNcS1uDjm+qwK2urKe8uKqjZ2KGSjtbLUpTO0iDYSBSg6CzCk1LNDVAZnOAvNiUkLu8r8vPnFw6bXZbbXcn0vUU8q2q38Olyfb0y7OhlnV9u6N4zuAH9uI=" ,
694
- "duration_secs" : 60.0 ,
695
698
}
696
699
)
697
700
_attachments .append (
698
701
{
699
702
"id" : index ,
700
703
"filename" : file .filename ,
701
704
"description" : file .description ,
705
+ "waveform" : file .waveform ,
706
+ "duration_secs" : file .duration_secs ,
707
+ # TODO: Fix content_type
708
+ "content_type" : "audio/wav" ,
702
709
}
703
710
)
704
711
@@ -1586,6 +1593,7 @@ async def send(
1586
1593
thread : Snowflake = MISSING ,
1587
1594
thread_name : str | None = None ,
1588
1595
applied_tags : list [Snowflake ] = MISSING ,
1596
+ voice_message : bool = MISSING ,
1589
1597
wait : Literal [True ],
1590
1598
delete_after : float = None ,
1591
1599
) -> WebhookMessage : ...
@@ -1609,6 +1617,7 @@ async def send(
1609
1617
thread : Snowflake = MISSING ,
1610
1618
thread_name : str | None = None ,
1611
1619
applied_tags : list [Snowflake ] = MISSING ,
1620
+ voice_message : bool = MISSING ,
1612
1621
wait : Literal [False ] = ...,
1613
1622
delete_after : float = None ,
1614
1623
) -> None : ...
@@ -1631,6 +1640,7 @@ async def send(
1631
1640
thread : Snowflake = MISSING ,
1632
1641
thread_name : str | None = None ,
1633
1642
applied_tags : list [Snowflake ] = MISSING ,
1643
+ voice_message : bool = MISSING ,
1634
1644
wait : bool = False ,
1635
1645
delete_after : float = None ,
1636
1646
) -> WebhookMessage | None :
@@ -1713,6 +1723,10 @@ async def send(
1713
1723
The poll to send.
1714
1724
1715
1725
.. versionadded:: 2.6
1726
+ voice_message: :class:`bool`
1727
+ If the file should be treated as a voice message.
1728
+
1729
+ .. versionadded:: 2.7
1716
1730
1717
1731
Returns
1718
1732
-------
@@ -1790,6 +1804,7 @@ async def send(
1790
1804
applied_tags = applied_tags ,
1791
1805
allowed_mentions = allowed_mentions ,
1792
1806
previous_allowed_mentions = previous_mentions ,
1807
+ voice_message = voice_message
1793
1808
)
1794
1809
adapter = async_context .get ()
1795
1810
thread_id : int | None = None
0 commit comments