Browse Source

Rename Interaction.original_message to original_response

pull/8316/head
Rapptz 3 years ago
parent
commit
9ce1541775
  1. 2
      discord/ext/commands/context.py
  2. 24
      discord/interactions.py

2
discord/ext/commands/context.py

@ -873,7 +873,7 @@ class Context(discord.abc.Messageable, Generic[BotT]):
msg = await self.interaction.followup.send(**kwargs, wait=True)
else:
await self.interaction.response.send_message(**kwargs)
msg = await self.interaction.original_message()
msg = await self.interaction.original_response()
if delete_after is not None and not (ephemeral and self.interaction is not None):
await msg.delete(delay=delete_after)

24
discord/interactions.py

@ -138,7 +138,7 @@ class Interaction:
'_client',
'_session',
'_baton',
'_original_message',
'_original_response',
'_cs_response',
'_cs_followup',
'_cs_channel',
@ -150,7 +150,7 @@ class Interaction:
self._state: ConnectionState = state
self._client: Client = state._get_client()
self._session: ClientSession = state.http._HTTPClient__session # type: ignore # Mangled attribute for __session
self._original_message: Optional[InteractionMessage] = None
self._original_response: Optional[InteractionMessage] = None
# This baton is used for extra data that might be useful for the lifecycle of
# an interaction. This is mainly for internal purposes and it gives it a free-for-all slot.
self._baton: Any = MISSING
@ -328,7 +328,7 @@ class Interaction:
""":class:`bool`: Returns ``True`` if the interaction is expired."""
return utils.utcnow() >= self.expires_at
async def original_message(self) -> InteractionMessage:
async def original_response(self) -> InteractionMessage:
"""|coro|
Fetches the original interaction response message associated with the interaction.
@ -355,8 +355,8 @@ class Interaction:
The original interaction response message.
"""
if self._original_message is not None:
return self._original_message
if self._original_response is not None:
return self._original_response
# TODO: fix later to not raise?
channel = self.channel
@ -375,10 +375,10 @@ class Interaction:
state = _InteractionMessageState(self, self._state)
# The state and channel parameters are mocked here
message = InteractionMessage(state=state, channel=channel, data=data) # type: ignore
self._original_message = message
self._original_response = message
return message
async def edit_original_message(
async def edit_original_response(
self,
*,
content: Optional[str] = MISSING,
@ -471,7 +471,7 @@ class Interaction:
self._state.store_view(view, message.id, interaction_id=self.id)
return message
async def delete_original_message(self) -> None:
async def delete_original_response(self) -> None:
"""|coro|
Deletes the original interaction response message.
@ -935,7 +935,7 @@ class InteractionMessage(Message):
"""Represents the original interaction response message.
This allows you to edit or delete the message associated with
the interaction response. To retrieve this object see :meth:`Interaction.original_message`.
the interaction response. To retrieve this object see :meth:`Interaction.original_response`.
This inherits from :class:`discord.Message` with changes to
:meth:`edit` and :meth:`delete` to work.
@ -1000,7 +1000,7 @@ class InteractionMessage(Message):
:class:`InteractionMessage`
The newly edited message.
"""
return await self._state._interaction.edit_original_message(
return await self._state._interaction.edit_original_response(
content=content,
embeds=embeds,
embed=embed,
@ -1087,10 +1087,10 @@ class InteractionMessage(Message):
async def inner_call(delay: float = delay):
await asyncio.sleep(delay)
try:
await self._state._interaction.delete_original_message()
await self._state._interaction.delete_original_response()
except HTTPException:
pass
asyncio.create_task(inner_call())
else:
await self._state._interaction.delete_original_message()
await self._state._interaction.delete_original_response()

Loading…
Cancel
Save