@@ -521,13 +521,17 @@ async def _edit(
521
521
)
522
522
elif isinstance (default_reaction_emoji , str ):
523
523
default_reaction_emoji = PartialEmoji .from_str (default_reaction_emoji )
524
+ elif default_reaction_emoji is None :
525
+ pass
524
526
else :
525
527
raise InvalidArgument (
526
- "default_reaction_emoji must be of type: GuildEmoji | int | str"
528
+ "default_reaction_emoji must be of type: GuildEmoji | int | str | None "
527
529
)
528
530
529
531
options ["default_reaction_emoji" ] = (
530
532
default_reaction_emoji ._to_forum_reaction_payload ()
533
+ if default_reaction_emoji
534
+ else None
531
535
)
532
536
533
537
if options :
@@ -1493,9 +1497,9 @@ async def send(
1493
1497
.. versionadded:: 1.4
1494
1498
1495
1499
reference: Union[:class:`~discord.Message`, :class:`~discord.MessageReference`, :class:`~discord.PartialMessage`]
1496
- A reference to the :class:`~discord.Message` to which you are replying, this can be created using
1497
- :meth:`~discord.Message.to_reference` or passed directly as a :class:`~discord.Message`. You can control
1498
- whether this mentions the author of the referenced message using the
1500
+ A reference to the :class:`~discord.Message` being replied to or forwarded. This can be created using
1501
+ :meth:`~discord.Message.to_reference`.
1502
+ When replying, you can control whether this mentions the author of the referenced message using the
1499
1503
:attr:`~discord.AllowedMentions.replied_user` attribute of ``allowed_mentions`` or by
1500
1504
setting ``mention_author``.
1501
1505
@@ -1585,9 +1589,19 @@ async def send(
1585
1589
allowed_mentions = allowed_mentions or AllowedMentions ().to_dict ()
1586
1590
allowed_mentions ["replied_user" ] = bool (mention_author )
1587
1591
1592
+ _reference = None
1588
1593
if reference is not None :
1589
1594
try :
1590
- reference = reference .to_message_reference_dict ()
1595
+ _reference = reference .to_message_reference_dict ()
1596
+ from .message import MessageReference
1597
+
1598
+ if not isinstance (reference , MessageReference ):
1599
+ utils .warn_deprecated (
1600
+ f"Passing { type (reference ).__name__ } to reference" ,
1601
+ "MessageReference" ,
1602
+ "2.7" ,
1603
+ "3.0" ,
1604
+ )
1591
1605
except AttributeError :
1592
1606
raise InvalidArgument (
1593
1607
"reference parameter must be Message, MessageReference, or"
@@ -1637,7 +1651,7 @@ async def send(
1637
1651
nonce = nonce ,
1638
1652
enforce_nonce = enforce_nonce ,
1639
1653
allowed_mentions = allowed_mentions ,
1640
- message_reference = reference ,
1654
+ message_reference = _reference ,
1641
1655
stickers = stickers ,
1642
1656
components = components ,
1643
1657
flags = flags .value ,
@@ -1656,7 +1670,7 @@ async def send(
1656
1670
nonce = nonce ,
1657
1671
enforce_nonce = enforce_nonce ,
1658
1672
allowed_mentions = allowed_mentions ,
1659
- message_reference = reference ,
1673
+ message_reference = _reference ,
1660
1674
stickers = stickers ,
1661
1675
components = components ,
1662
1676
flags = flags .value ,
0 commit comments