Skip to content

Commit ff765b4

Browse files
committed
Update code for new linter rules
1 parent 9325140 commit ff765b4

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

docs/changelog.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ Changelog
55
=========
66

77

8+
- :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.
9+
- :support:`184` Bump Discord.py to :literal-url:`2.3.1 <https://github.com/Rapptz/discord.py/releases/tag/v2.3.1>`.
810
- :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`.
9-
- :bug:`184` Bump Discord.py to :literal-url:`2.3.1 <https://github.com/Rapptz/discord.py/releases/tag/v2.3.1>`.
1011

1112

1213
- :release:`9.9.2 <2nd July 2023>`

pydis_core/async_stats.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def __init__(
1616
loop: asyncio.AbstractEventLoop,
1717
host: str = "localhost",
1818
port: int = 8125,
19-
prefix: str = None
19+
prefix: str | None = None
2020
):
2121
"""
2222
Create a new :obj:`AsyncStatsClient`.

pydis_core/utils/interactions.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from discord import ButtonStyle, HTTPException, Interaction, Message, NotFound, ui
55

66
from pydis_core.utils.logging import get_logger
7+
from pydis_core.utils.scheduling import create_task
78

89
log = get_logger(__name__)
910

@@ -80,6 +81,12 @@ async def interaction_check(self, interaction: Interaction) -> bool:
8081
await interaction.response.send_message("This is not your button to click!", ephemeral=True)
8182
return False
8283

84+
def stop(self) -> None:
85+
"""Stop listening for interactions, and remove the view from ``self.message`` if set."""
86+
super().stop()
87+
if self.message:
88+
create_task(_handle_modify_message(self.message, "edit"))
89+
8390
async def on_timeout(self) -> None:
8491
"""Remove the view from ``self.message`` if set."""
8592
if self.message:

0 commit comments

Comments
 (0)