@@ -758,6 +758,11 @@ async def respond(
758
758
ephemeral: :class:`bool`
759
759
Whether the paginator message and its components are ephemeral.
760
760
If ``target`` is specified, the ephemeral message content will be ``target_message`` instead.
761
+
762
+ .. warning::
763
+
764
+ If your paginator is ephemeral, it cannot have a timeout longer than 15 minutes (and cannot be persistent).
765
+
761
766
target: Optional[:class:`~discord.abc.Messageable`]
762
767
A target where the paginated message should be sent, if different from the original :class:`discord.Interaction`
763
768
target_message: :class:`str`
@@ -775,7 +780,7 @@ async def respond(
775
780
if target is not None and not isinstance (target , discord .abc .Messageable ):
776
781
raise TypeError (f"expected abc.Messageable not { target .__class__ !r} " )
777
782
778
- if ephemeral and self .timeout >= 900 or self .timeout is None :
783
+ if ephemeral and ( self .timeout >= 900 or self .timeout is None ) :
779
784
raise ValueError (
780
785
"paginator responses cannot be ephemeral if the paginator timeout is 15 minutes or greater"
781
786
)
@@ -801,18 +806,17 @@ async def respond(
801
806
view = self ,
802
807
ephemeral = ephemeral ,
803
808
)
804
- # convert from WebhookMessage to Message reference to bypass 15min webhook token timeout
805
- msg = await msg .channel .fetch_message (msg .id )
809
+ # convert from WebhookMessage to Message reference to bypass 15min webhook token timeout (non-ephemeral messages only)
810
+ if not ephemeral :
811
+ msg = await msg .channel .fetch_message (msg .id )
806
812
else :
807
813
msg = await interaction .response .send_message (
808
814
content = page_content .content ,
809
815
embeds = page_content .embeds ,
810
816
view = self ,
811
817
ephemeral = ephemeral ,
812
818
)
813
- if isinstance (msg , discord .WebhookMessage ):
814
- self .message = await msg .channel .fetch_message (msg .id )
815
- elif isinstance (msg , discord .Message ):
819
+ if isinstance (msg , (discord .Message , discord .WebhookMessage )):
816
820
self .message = msg
817
821
elif isinstance (msg , discord .Interaction ):
818
822
self .message = await msg .original_message ()
0 commit comments