Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Creadeyh committed Dec 3, 2022
2 parents b7ce327 + cf66ea2 commit 85f8ca9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
6 changes: 6 additions & 0 deletions doc/changelog.md
Original file line number Diff line number Diff line change
@@ -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:**
Expand Down
7 changes: 7 additions & 0 deletions extensions/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 3 additions & 1 deletion extensions/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 85f8ca9

Please sign in to comment.