74
74
from ..file import File
75
75
from ..guild import Guild
76
76
from ..http import Response
77
+ from ..interactions import Interaction
77
78
from ..mentions import AllowedMentions
78
79
from ..poll import Poll
79
80
from ..state import ConnectionState
@@ -1203,6 +1204,12 @@ async def foo():
1203
1204
Only given if :attr:`type` is :attr:`WebhookType.channel_follower`.
1204
1205
1205
1206
.. versionadded:: 2.0
1207
+
1208
+ parent: Optional[:class:`Interaction`]
1209
+ The interaction this webhook belongs to.
1210
+ Only set if :attr:`type` is :attr:`WebhookType.application`.
1211
+
1212
+ .. versionadded:: 2.7
1206
1213
"""
1207
1214
1208
1215
__slots__ : tuple [str , ...] = ("session" , "proxy" , "proxy_auth" )
@@ -1215,11 +1222,13 @@ def __init__(
1215
1222
proxy_auth : aiohttp .BasicAuth | None = None ,
1216
1223
token : str | None = None ,
1217
1224
state = None ,
1225
+ parent : Interaction | None = None
1218
1226
):
1219
1227
super ().__init__ (data , token , state )
1220
1228
self .session = session
1221
1229
self .proxy : str | None = proxy
1222
1230
self .proxy_auth : aiohttp .BasicAuth | None = proxy_auth
1231
+ self .parent : Interaction | None = parent
1223
1232
1224
1233
def __repr__ (self ):
1225
1234
return f"<Webhook id={ self .id !r} >"
@@ -1867,6 +1876,8 @@ async def send(
1867
1876
if view and not view .is_finished ():
1868
1877
message_id = None if msg is None else msg .id
1869
1878
view .message = None if msg is None else msg
1879
+ if self .parent and not view .parent :
1880
+ view .parent = self .parent
1870
1881
if msg :
1871
1882
view .refresh (msg .components )
1872
1883
if view .is_dispatchable ():
0 commit comments