|
|
@ -1071,24 +1071,18 @@ class InteractionResponse(Generic[ClientT]): |
|
|
|
proxy_auth=http.proxy_auth, |
|
|
|
params=params, |
|
|
|
) |
|
|
|
self._response_type = InteractionResponseType.channel_message |
|
|
|
ret = InteractionCallbackResponse( |
|
|
|
data=response, |
|
|
|
parent=self._parent, |
|
|
|
state=self._parent._state, |
|
|
|
type=self._response_type, |
|
|
|
) |
|
|
|
|
|
|
|
if view is not MISSING and not view.is_finished(): |
|
|
|
if ephemeral and view.timeout is None: |
|
|
|
view.timeout = 15 * 60.0 |
|
|
|
|
|
|
|
# this assertion should never fail because the resource of a send_message |
|
|
|
# response will always be an InteractionMessage |
|
|
|
assert isinstance(ret.resource, InteractionMessage) |
|
|
|
entity_id = ret.resource.id if parent.type is InteractionType.application_command else None |
|
|
|
# If the interaction type isn't an application command then there's no way |
|
|
|
# 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: |
|
|
|
|
|
|
|
async def inner_call(delay: float = delete_after): |
|
|
@ -1100,7 +1094,12 @@ class InteractionResponse(Generic[ClientT]): |
|
|
|
|
|
|
|
asyncio.create_task(inner_call()) |
|
|
|
|
|
|
|
return ret |
|
|
|
return InteractionCallbackResponse( |
|
|
|
data=response, |
|
|
|
parent=self._parent, |
|
|
|
state=self._parent._state, |
|
|
|
type=self._response_type, |
|
|
|
) |
|
|
|
|
|
|
|
@overload |
|
|
|
async def edit_message( |
|
|
@ -1209,7 +1208,14 @@ class InteractionResponse(Generic[ClientT]): |
|
|
|
parent = self._parent |
|
|
|
msg = parent.message |
|
|
|
state = parent._state |
|
|
|
message_id = msg and msg.id |
|
|
|
if msg is not None: |
|
|
|
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: |
|
|
|
message_id = None |
|
|
|
original_interaction_id = None |
|
|
|
|
|
|
|
if parent.type not in (InteractionType.component, InteractionType.modal_submit): |
|
|
|
return |
|
|
@ -1247,7 +1253,7 @@ class InteractionResponse(Generic[ClientT]): |
|
|
|
) |
|
|
|
|
|
|
|
if view and not view.is_finished(): |
|
|
|
state.store_view(view, message_id) |
|
|
|
state.store_view(view, message_id, interaction_id=original_interaction_id) |
|
|
|
|
|
|
|
self._response_type = InteractionResponseType.message_update |
|
|
|
|
|
|
|