From 9e1ac4f80c3eab4ad90a0748a743394d8bfdadd0 Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Mon, 26 Jun 2023 09:42:26 +0100 Subject: Bump d.py to 2.3.1 --- docs/changelog.rst | 3 +++ 1 file changed, 3 insertions(+) (limited to 'docs') diff --git a/docs/changelog.rst b/docs/changelog.rst index a6b1d193..9abd475a 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -4,7 +4,10 @@ Changelog ========= + - :bug:`187` Fix :obj:`pydis_core.utils.channel.get_or_fetch_channel`'s return type to include :obj:`discord.abc.PrivateChannel` and :obj:`discord.Thread`. +- :bug:`184` Bump Discord.py to :literal-url:`2.3.1 `. + - :release:`9.9.2 <2nd July 2023>` - :bug:`185` Update expiry label from 1 month to 30 days in paste service. -- cgit v1.2.3 From ff765b41eb005865c12c662a786761961a7ec616 Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Mon, 26 Jun 2023 09:45:16 +0100 Subject: Update code for new linter rules --- docs/changelog.rst | 3 ++- pydis_core/async_stats.py | 2 +- pydis_core/utils/interactions.py | 7 +++++++ 3 files changed, 10 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/changelog.rst b/docs/changelog.rst index 9abd475a..e8cc8ca0 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -5,8 +5,9 @@ Changelog ========= +- :feature:`184` Remove the message 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 `. - :bug:`187` Fix :obj:`pydis_core.utils.channel.get_or_fetch_channel`'s return type to include :obj:`discord.abc.PrivateChannel` and :obj:`discord.Thread`. -- :bug:`184` Bump Discord.py to :literal-url:`2.3.1 `. - :release:`9.9.2 <2nd July 2023>` 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: -- cgit v1.2.3