Skip to content

Commit

Permalink
Update code for new linter rules
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisLovering committed Jul 14, 2023
1 parent 9325140 commit ff765b4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/Rapptz/discord.py/releases/tag/v2.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 <https://github.com/Rapptz/discord.py/releases/tag/v2.3.1>`.


- :release:`9.9.2 <2nd July 2023>`
Expand Down
2 changes: 1 addition & 1 deletion pydis_core/async_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def __init__(
loop: asyncio.AbstractEventLoop,
host: str = "localhost",
port: int = 8125,
prefix: str = None
prefix: str | None = None
):
"""
Create a new :obj:`AsyncStatsClient`.
Expand Down
7 changes: 7 additions & 0 deletions pydis_core/utils/interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
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__)

Expand Down Expand Up @@ -80,6 +81,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

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:
Expand Down

0 comments on commit ff765b4

Please sign in to comment.