Skip to content

Commit

Permalink
Remove view from ViewWithUserAndRoleCheck.message on interaction stop…
Browse files Browse the repository at this point in the history
…, if set
  • Loading branch information
ChrisLovering committed Jun 27, 2023
1 parent ddc2fb7 commit d7eede3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 3 additions & 2 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
Changelog
=========
- :release:`9.9.2 <26th June 2023>`
- :bug:`184` Bump Discord.py to :literal-url:`2.3.1 <https://github.com/Rapptz/discord.py/releases/tag/v2.3.1>`.
- :release:`9.10.0 <27th June 2023>`
- :support:`184` Remove the message, as stored in the ``message`` attr of :obj:`pydis_core.utils.interactions.ViewWithUserAndRoleCheck` when the interaction is stopped, in additional to the exist logic for timeout.
- :support:`184` Bump Discord.py to :literal-url:`2.3.1 <https://github.com/Rapptz/discord.py/releases/tag/v2.3.1>`.


- :release:`9.9.1 <22th June 2023>`
Expand Down
6 changes: 6 additions & 0 deletions pydis_core/utils/interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ async def interaction_check(self, interaction: Interaction) -> bool:
await interaction.response.send_message("This is not your button to click!", ephemeral=True)
return False

async def stop(self) -> None:
"""Stop listening for interactions, and remove the view from ``self.message`` if set."""
super().stop()
if self.message:
await _handle_modify_message(self.message, "edit")

async def on_timeout(self) -> None:
"""Remove the view from ``self.message`` if set."""
if self.message:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pydis_core"
version = "9.9.2"
version = "9.10.0"
description = "PyDis core provides core functionality and utility to the bots of the Python Discord community."
authors = ["Python Discord <info@pythondiscord.com>"]
license = "MIT"
Expand Down

0 comments on commit d7eede3

Please sign in to comment.