From addfc109c872fdf5f85d12a9a4218b1a4a3142ed Mon Sep 17 00:00:00 2001 From: vivekashok1221 Date: Wed, 19 Feb 2025 20:51:16 +0400 Subject: [PATCH 1/2] fix: check category before moving to appeal category This is to prevent attempting to move the thread to the ban appeal category when a user leaves and rejoins the ban appeal server. --- ban_appeals/ban_appeals.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/ban_appeals/ban_appeals.py b/ban_appeals/ban_appeals.py index 183eedb..7102f5f 100644 --- a/ban_appeals/ban_appeals.py +++ b/ban_appeals/ban_appeals.py @@ -157,20 +157,23 @@ async def _handle_join(self, member: discord.Member) -> None: if not thread: return - category = await self.get_useable_appeal_category() + description = "The recipient has joined the appeals server." + if thread.channel.category.id not in self.appeal_categories: + category = await self.get_useable_appeal_category() + description = f"Thread moved to `{category}` category since recipient has joined the appeals server." + await thread.channel.move( + category=category, + end=True, + sync_permissions=True, + reason=f"{member} joined appeals server.", + ) + embed = discord.Embed( - description=f"Moving thread to `{category}` category since recipient has joined the appeals server.", + description=description, color=self.bot.mod_color ) await thread.channel.send(embed=embed) - await thread.channel.move( - category=category, - end=True, - sync_permissions=True, - reason=f"{member} joined appeals server.", - ) - async def _handle_remove(self, member: discord.Member) -> None: """ Notify if a member who is appealing leaves the appeals guild. From c448800af8f7847b0d8902e6f04c2aa9b5910ed3 Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Thu, 20 Feb 2025 18:26:14 +0000 Subject: [PATCH 2/2] Update CI --- .github/workflows/lint.yaml | 9 +++++---- pyproject.toml | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 38288c1..f75653c 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -20,9 +20,9 @@ jobs: uses: actions/checkout@v2 - name: Install Python Dependencies - uses: HassanAbouelela/actions/setup-python@setup-python_v1.3.2 + uses: HassanAbouelela/actions/setup-python@setup-python_v1.6.0 with: - dev: true + install_args: --no-root python_version: '3.9' # We will not run `flake8` here, as we will use a separate flake8 @@ -39,5 +39,6 @@ jobs: # Format used: # ::error file={filename},line={line},col={col}::{message} - name: Run flake8 - run: "flake8 \ - --format='::error file=%(path)s,line=%(row)d,col=%(col)d::[flake8] %(code)s: %(text)s'" + run: | + flake8 \ + --format='::error file=%(path)s,line=%(row)d,col=%(col)d::[flake8] %(code)s: %(text)s' diff --git a/pyproject.toml b/pyproject.toml index b34aa48..f27de53 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,6 +4,7 @@ version = "1.0.0" description = "A collection of modmail plugins for the Python Discord community." authors = ["Python Discord "] license = "MIT" +package-mode = false [tool.poetry.dependencies] python = "3.9.*"