Skip to content

Commit ed31d15

Browse files
committed
Remove view from ViewWithUserAndRoleCheck.message on interaction stop, if set
1 parent ddc2fb7 commit ed31d15

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

docs/changelog.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
44
Changelog
55
=========
6-
- :release:`9.9.2 <26th June 2023>`
7-
- :bug:`184` Bump Discord.py to :literal-url:`2.3.1 <https://github.com/Rapptz/discord.py/releases/tag/v2.3.1>`.
6+
- :release:`9.10.0 <27th June 2023>`
7+
- :feature:`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.
8+
- :support:`184` Bump Discord.py to :literal-url:`2.3.1 <https://github.com/Rapptz/discord.py/releases/tag/v2.3.1>`.
89

910

1011
- :release:`9.9.1 <22th June 2023>`

pydis_core/utils/interactions.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ async def interaction_check(self, interaction: Interaction) -> bool:
8080
await interaction.response.send_message("This is not your button to click!", ephemeral=True)
8181
return False
8282

83+
async def stop(self) -> None:
84+
"""Stop listening for interactions, and remove the view from ``self.message`` if set."""
85+
super().stop()
86+
if self.message:
87+
await _handle_modify_message(self.message, "edit")
88+
8389
async def on_timeout(self) -> None:
8490
"""Remove the view from ``self.message`` if set."""
8591
if self.message:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "pydis_core"
3-
version = "9.9.2"
3+
version = "9.10.0"
44
description = "PyDis core provides core functionality and utility to the bots of the Python Discord community."
55
authors = ["Python Discord <info@pythondiscord.com>"]
66
license = "MIT"

0 commit comments

Comments
 (0)