From 77920359abf5c981150e4f5176a0d486fb5a5c87 Mon Sep 17 00:00:00 2001 From: Creadeyh Date: Sat, 3 Dec 2022 14:32:28 +0100 Subject: [PATCH 1/2] Removed mention of already done AFK members --- extensions/checks.py | 7 +++++++ extensions/utils.py | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/extensions/checks.py b/extensions/checks.py index cc0c29d..a2f5b29 100644 --- a/extensions/checks.py +++ b/extensions/checks.py @@ -91,4 +91,11 @@ def check_is_afk(author: pycord.Member, guild: pycord.Guild): afk_role = pycord.utils.get(guild.roles, name="AFK") return afk_role in author.roles +def check_is_id_afk(member_id: Union[int, str], guild: pycord.Guild): + if isinstance(member_id, str): + id: int = int(member_id.replace("alt", "")) + else: + id: int = member_id + return check_is_afk(guild.get_member(id), guild) + #endregion diff --git a/extensions/utils.py b/extensions/utils.py index a54c062..c35c1c4 100644 --- a/extensions/utils.py +++ b/extensions/utils.py @@ -2,6 +2,7 @@ import interactions import extensions.db_connection as db +from extensions.checks import check_is_id_afk import json from typing import * @@ -56,7 +57,8 @@ async def generate_contract_message_content_component(pycord_bot: pycord.Client, if is_leggacy: already_done_mentions = [] for id in contract_dic["already_done"]: - already_done_mentions.append(await get_member_mention(id, guild, pycord_bot, db_connection)) + if not check_is_id_afk(id, guild): + already_done_mentions.append(await get_member_mention(id, guild, pycord_bot, db_connection)) remaining_mentions = [] for id in contract_dic["remaining"]: remaining_mentions.append(await get_member_mention(id, guild, pycord_bot, db_connection)) From cf66ea24de1dc7d86b6f4c3ec1f1ad99ff6f20bc Mon Sep 17 00:00:00 2001 From: Creadeyh Date: Sat, 3 Dec 2022 14:34:41 +0100 Subject: [PATCH 2/2] Changelog v2.0.1 --- doc/changelog.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/changelog.md b/doc/changelog.md index b44e6a1..471dc28 100644 --- a/doc/changelog.md +++ b/doc/changelog.md @@ -1,5 +1,11 @@ # Changelog +## v2.0.1 + +**Changes:** + +- Removed mention of already done AFK members when a leggacy contract is added, to avoid this mild annoyance to AFK members + ## v2.0.0 **Changes:**