@ -615,7 +615,7 @@ class Interaction(Generic[ClientT]):
state = _InteractionMessageState ( self , self . _state )
state = _InteractionMessageState ( self , self . _state )
message = InteractionMessage ( state = state , channel = self . channel , data = data ) # type: ignore
message = InteractionMessage ( state = state , channel = self . channel , data = data ) # type: ignore
if view and not view . is_finished ( ) and view . is_dispatchable ( ) :
if view and not view . is_finished ( ) and view . is_dispatchable ( ) :
self . _state . store_view ( view , message . id , interaction_id = self . id )
self . _state . store_view ( view , message . id )
return message
return message
async def delete_original_response ( self ) - > None :
async def delete_original_response ( self ) - > None :
@ -1082,7 +1082,7 @@ class InteractionResponse(Generic[ClientT]):
)
)
http = parent . _state . http
http = parent . _state . http
response = await adapter . create_interaction_response (
data = await adapter . create_interaction_response (
parent . id ,
parent . id ,
parent . token ,
parent . token ,
session = parent . _session ,
session = parent . _session ,
@ -1090,17 +1090,19 @@ class InteractionResponse(Generic[ClientT]):
proxy_auth = http . proxy_auth ,
proxy_auth = http . proxy_auth ,
params = params ,
params = params ,
)
)
self . _response_type = InteractionResponseType . channel_message
response = InteractionCallbackResponse (
data = data ,
parent = self . _parent ,
state = self . _parent . _state ,
type = self . _response_type ,
)
if view is not MISSING and not view . is_finished ( ) :
if view is not MISSING and not view . is_finished ( ) :
if ephemeral and view . timeout is None :
if ephemeral and view . timeout is None :
view . timeout = 15 * 60.0
view . timeout = 15 * 60.0
# If the interaction type isn't an application command then there's no way
self . _parent . _state . store_view ( view , response . message_id )
# to obtain this interaction_id again, so just default to None
entity_id = parent . id if parent . type is InteractionType . application_command else None
self . _parent . _state . store_view ( view , entity_id )
self . _response_type = InteractionResponseType . channel_message
if delete_after is not None :
if delete_after is not None :
@ -1113,12 +1115,7 @@ class InteractionResponse(Generic[ClientT]):
asyncio . create_task ( inner_call ( ) )
asyncio . create_task ( inner_call ( ) )
return InteractionCallbackResponse (
return response
data = response ,
parent = self . _parent ,
state = self . _parent . _state ,
type = self . _response_type ,
)
async def edit_message (
async def edit_message (
self ,
self ,
@ -1205,12 +1202,8 @@ class InteractionResponse(Generic[ClientT]):
state = parent . _state
state = parent . _state
if msg is not None :
if msg is not None :
message_id = msg . id
message_id = msg . id
# If this was invoked via an application command then we can use its original interaction ID
# Since this is used as a cache key for view updates
original_interaction_id = msg . interaction_metadata . id if msg . interaction_metadata is not None else None
else :
else :
message_id = None
message_id = None
original_interaction_id = None
if parent . type not in ( InteractionType . component , InteractionType . modal_submit ) :
if parent . type not in ( InteractionType . component , InteractionType . modal_submit ) :
return
return
@ -1238,7 +1231,7 @@ class InteractionResponse(Generic[ClientT]):
)
)
http = parent . _state . http
http = parent . _state . http
response = await adapter . create_interaction_response (
data = await adapter . create_interaction_response (
parent . id ,
parent . id ,
parent . token ,
parent . token ,
session = parent . _session ,
session = parent . _session ,
@ -1246,11 +1239,16 @@ class InteractionResponse(Generic[ClientT]):
proxy_auth = http . proxy_auth ,
proxy_auth = http . proxy_auth ,
params = params ,
params = params ,
)
)
self . _response_type = InteractionResponseType . message_update
response = InteractionCallbackResponse (
data = data ,
parent = self . _parent ,
state = self . _parent . _state ,
type = self . _response_type ,
)
if view and not view . is_finished ( ) and view . is_dispatchable ( ) :
if view and not view . is_finished ( ) and view . is_dispatchable ( ) :
state . store_view ( view , message_id , interaction_id = original_interaction_id )
state . store_view ( view , message_id or response . message_id )
self . _response_type = InteractionResponseType . message_update
if delete_after is not None :
if delete_after is not None :
@ -1263,12 +1261,7 @@ class InteractionResponse(Generic[ClientT]):
asyncio . create_task ( inner_call ( ) )
asyncio . create_task ( inner_call ( ) )
return InteractionCallbackResponse (
return response
data = response ,
parent = self . _parent ,
state = self . _parent . _state ,
type = self . _response_type ,
)
async def send_modal ( self , modal : Modal , / ) - > InteractionCallbackResponse [ ClientT ] :
async def send_modal ( self , modal : Modal , / ) - > InteractionCallbackResponse [ ClientT ] :
""" |coro|
""" |coro|