89
89
from .guild import Guild
90
90
from .member import Member
91
91
from .message import Message , MessageReference , PartialMessage
92
+ from .poll import Poll
92
93
from .state import ConnectionState
93
94
from .threads import Thread
94
95
from .types .channel import Channel as ChannelPayload
@@ -115,7 +116,7 @@ async def _single_delete_strategy(
115
116
116
117
117
118
async def _purge_messages_helper (
118
- channel : TextChannel | Thread | VoiceChannel ,
119
+ channel : TextChannel | StageChannel | Thread | VoiceChannel ,
119
120
* ,
120
121
limit : int | None = 100 ,
121
122
check : Callable [[Message ], bool ] = MISSING ,
@@ -1345,12 +1346,13 @@ async def send(
1345
1346
file : File = ...,
1346
1347
stickers : Sequence [GuildSticker | StickerItem ] = ...,
1347
1348
delete_after : float = ...,
1348
- nonce : str | int = ...,
1349
+ nonce : int | str = ...,
1349
1350
enforce_nonce : bool = ...,
1350
1351
allowed_mentions : AllowedMentions = ...,
1351
1352
reference : Message | MessageReference | PartialMessage = ...,
1352
1353
mention_author : bool = ...,
1353
1354
view : View = ...,
1355
+ poll : Poll = ...,
1354
1356
suppress : bool = ...,
1355
1357
silent : bool = ...,
1356
1358
) -> Message : ...
@@ -1365,12 +1367,13 @@ async def send(
1365
1367
files : list [File ] = ...,
1366
1368
stickers : Sequence [GuildSticker | StickerItem ] = ...,
1367
1369
delete_after : float = ...,
1368
- nonce : str | int = ...,
1370
+ nonce : int | str = ...,
1369
1371
enforce_nonce : bool = ...,
1370
1372
allowed_mentions : AllowedMentions = ...,
1371
1373
reference : Message | MessageReference | PartialMessage = ...,
1372
1374
mention_author : bool = ...,
1373
1375
view : View = ...,
1376
+ poll : Poll = ...,
1374
1377
suppress : bool = ...,
1375
1378
silent : bool = ...,
1376
1379
) -> Message : ...
@@ -1385,12 +1388,13 @@ async def send(
1385
1388
file : File = ...,
1386
1389
stickers : Sequence [GuildSticker | StickerItem ] = ...,
1387
1390
delete_after : float = ...,
1388
- nonce : str | int = ...,
1391
+ nonce : int | str = ...,
1389
1392
enforce_nonce : bool = ...,
1390
1393
allowed_mentions : AllowedMentions = ...,
1391
1394
reference : Message | MessageReference | PartialMessage = ...,
1392
1395
mention_author : bool = ...,
1393
1396
view : View = ...,
1397
+ poll : Poll = ...,
1394
1398
suppress : bool = ...,
1395
1399
silent : bool = ...,
1396
1400
) -> Message : ...
@@ -1405,12 +1409,13 @@ async def send(
1405
1409
files : list [File ] = ...,
1406
1410
stickers : Sequence [GuildSticker | StickerItem ] = ...,
1407
1411
delete_after : float = ...,
1408
- nonce : str | int = ...,
1412
+ nonce : int | str = ...,
1409
1413
enforce_nonce : bool = ...,
1410
1414
allowed_mentions : AllowedMentions = ...,
1411
1415
reference : Message | MessageReference | PartialMessage = ...,
1412
1416
mention_author : bool = ...,
1413
1417
view : View = ...,
1418
+ poll : Poll = ...,
1414
1419
suppress : bool = ...,
1415
1420
silent : bool = ...,
1416
1421
) -> Message : ...
@@ -1432,6 +1437,7 @@ async def send(
1432
1437
reference = None ,
1433
1438
mention_author = None ,
1434
1439
view = None ,
1440
+ poll = None ,
1435
1441
suppress = None ,
1436
1442
silent = None ,
1437
1443
):
@@ -1465,7 +1471,7 @@ async def send(
1465
1471
The file to upload.
1466
1472
files: List[:class:`~discord.File`]
1467
1473
A list of files to upload. Must be a maximum of 10.
1468
- nonce: :class:`int`
1474
+ nonce: Union[ :class:`str`, :class:` int`]
1469
1475
The nonce to use for sending this message. If the message was successfully sent,
1470
1476
then the message will have a nonce with this value.
1471
1477
enforce_nonce: Optional[:class:`bool`]
@@ -1515,6 +1521,10 @@ async def send(
1515
1521
Whether to suppress push and desktop notifications for the message.
1516
1522
1517
1523
.. versionadded:: 2.4
1524
+ poll: :class:`Poll`
1525
+ The poll to send.
1526
+
1527
+ .. versionadded:: 2.6
1518
1528
1519
1529
Returns
1520
1530
-------
@@ -1594,6 +1604,9 @@ async def send(
1594
1604
else :
1595
1605
components = None
1596
1606
1607
+ if poll :
1608
+ poll = poll .to_dict ()
1609
+
1597
1610
if file is not None and files is not None :
1598
1611
raise InvalidArgument ("cannot pass both file and files parameter to send()" )
1599
1612
@@ -1616,6 +1629,7 @@ async def send(
1616
1629
stickers = stickers ,
1617
1630
components = components ,
1618
1631
flags = flags ,
1632
+ poll = poll ,
1619
1633
)
1620
1634
finally :
1621
1635
file .close ()
@@ -1643,6 +1657,7 @@ async def send(
1643
1657
stickers = stickers ,
1644
1658
components = components ,
1645
1659
flags = flags ,
1660
+ poll = poll ,
1646
1661
)
1647
1662
finally :
1648
1663
for f in files :
@@ -1661,6 +1676,7 @@ async def send(
1661
1676
stickers = stickers ,
1662
1677
components = components ,
1663
1678
flags = flags ,
1679
+ poll = poll ,
1664
1680
)
1665
1681
1666
1682
ret = state .create_message (channel = channel , data = data )
0 commit comments