diff options
Diffstat (limited to 'pydis_core')
-rw-r--r-- | pydis_core/async_stats.py | 2 | ||||
-rw-r--r-- | pydis_core/utils/interactions.py | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/pydis_core/async_stats.py b/pydis_core/async_stats.py index ae409467..4c94d856 100644 --- a/pydis_core/async_stats.py +++ b/pydis_core/async_stats.py @@ -16,7 +16,7 @@ class AsyncStatsClient(StatsClientBase): loop: asyncio.AbstractEventLoop, host: str = "localhost", port: int = 8125, - prefix: str = None + prefix: str | None = None ): """ Create a new :obj:`AsyncStatsClient`. diff --git a/pydis_core/utils/interactions.py b/pydis_core/utils/interactions.py index cb5f26b4..d3432c3a 100644 --- a/pydis_core/utils/interactions.py +++ b/pydis_core/utils/interactions.py @@ -4,6 +4,7 @@ from typing import Literal from discord import ButtonStyle, HTTPException, Interaction, Message, NotFound, ui from pydis_core.utils.logging import get_logger +from pydis_core.utils.scheduling import create_task log = get_logger(__name__) @@ -80,6 +81,12 @@ class ViewWithUserAndRoleCheck(ui.View): await interaction.response.send_message("This is not your button to click!", ephemeral=True) return False + def stop(self) -> None: + """Stop listening for interactions, and remove the view from ``self.message`` if set.""" + super().stop() + if self.message: + create_task(_handle_modify_message(self.message, "edit")) + async def on_timeout(self) -> None: """Remove the view from ``self.message`` if set.""" if self.message: |