@@ -605,6 +605,9 @@ async def send(
605
605
ctx : Context ,
606
606
target : Optional [discord .abc .Messageable ] = None ,
607
607
target_message : Optional [str ] = None ,
608
+ reference : Optional [Union [discord .Message , discord .MessageReference , discord .PartialMessage ]] = None ,
609
+ allowed_mentions : Optional [discord .AllowedMentions ] = None ,
610
+ mention_author : bool = None ,
608
611
) -> discord .Message :
609
612
"""Sends a message with the paginated items.
610
613
@@ -616,6 +619,20 @@ async def send(
616
619
A target where the paginated message should be sent, if different from the original :class:`Context`
617
620
target_message: Optional[:class:`str`]
618
621
An optional message shown when the paginator message is sent elsewhere.
622
+ reference: Optional[Union[:class:`discord.Message`, :class:`discord.MessageReference`, :class:`discord.PartialMessage`]]
623
+ A reference to the :class:`~discord.Message` to which you are replying with the paginator. This can be created using
624
+ :meth:`~discord.Message.to_reference` or passed directly as a :class:`~discord.Message`. You can control
625
+ whether this mentions the author of the referenced message using the :attr:`~discord.AllowedMentions.replied_user`
626
+ attribute of ``allowed_mentions`` or by setting ``mention_author``.
627
+ allowed_mentions: Optional[:class:`~discord.AllowedMentions`]
628
+ Controls the mentions being processed in this message. If this is
629
+ passed, then the object is merged with :attr:`~discord.Client.allowed_mentions`.
630
+ The merging behaviour only overrides attributes that have been explicitly passed
631
+ to the object, otherwise it uses the attributes set in :attr:`~discord.Client.allowed_mentions`.
632
+ If no object is passed at all then the defaults given by :attr:`~discord.Client.allowed_mentions`
633
+ are used instead.
634
+ mention_author: Optional[:class:`bool`]
635
+ If set, overrides the :attr:`~discord.AllowedMentions.replied_user` attribute of ``allowed_mentions``.
619
636
620
637
Returns
621
638
--------
@@ -628,6 +645,17 @@ async def send(
628
645
if target is not None and not isinstance (target , discord .abc .Messageable ):
629
646
raise TypeError (f"expected abc.Messageable not { target .__class__ !r} " )
630
647
648
+ if reference is not None and not isinstance (
649
+ reference , (discord .Message , discord .MessageReference , discord .PartialMessage )
650
+ ):
651
+ raise TypeError (f"expected Message, MessageReference, or PartialMessage not { reference .__class__ !r} " )
652
+
653
+ if allowed_mentions is not None and not isinstance (allowed_mentions , discord .AllowedMentions ):
654
+ raise TypeError (f"expected AllowedMentions not { allowed_mentions .__class__ !r} " )
655
+
656
+ if mention_author is not None and not isinstance (mention_author , bool ):
657
+ raise TypeError (f"expected bool not { mention_author .__class__ !r} " )
658
+
631
659
self .update_buttons ()
632
660
page = self .pages [self .current_page ]
633
661
page = self .get_page_content (page )
@@ -636,13 +664,21 @@ async def send(
636
664
637
665
if target :
638
666
if target_message :
639
- await ctx .send (target_message )
667
+ await ctx .send (
668
+ target_message ,
669
+ reference = reference ,
670
+ allowed_mentions = allowed_mentions ,
671
+ mention_author = mention_author ,
672
+ )
640
673
ctx = target
641
674
642
675
self .message = await ctx .send (
643
676
content = page if isinstance (page , str ) else None ,
644
677
embeds = [] if isinstance (page , str ) else page ,
645
678
view = self ,
679
+ reference = reference ,
680
+ allowed_mentions = allowed_mentions ,
681
+ mention_author = mention_author ,
646
682
)
647
683
648
684
return self .message
0 commit comments