From bebef9d38a7ae8f7f3004255239b480b3c5e465b Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Mon, 12 Aug 2024 19:29:47 +0100 Subject: [PATCH] Update the thread name to have the members --- py/matching.py | 4 ++++ py/matchy.py | 2 +- py/util.py | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/py/matching.py b/py/matching.py index d001c2a..da74ee5 100644 --- a/py/matching.py +++ b/py/matching.py @@ -44,6 +44,10 @@ class Member(Protocol): def id(self) -> int: pass + @property + def display_name(self) -> str: + pass + @property def roles(self) -> list[Role]: pass diff --git a/py/matchy.py b/py/matchy.py index 28c73d3..c5ad950 100755 --- a/py/matchy.py +++ b/py/matchy.py @@ -202,7 +202,7 @@ class DynamicGroupButton(discord.ui.DynamicItem[discord.ui.Button], # Set up a thread for this match if the bot has permissions to do so if intrctn.channel.permissions_for(intrctn.guild.me).create_public_threads: await intrctn.channel.create_thread( - name=f"{util.format_today()} Group {chr(65 + idx)}", + name=f"{util.format_list([m.display_name for m in group])}", message=message, reason="Creating a matching thread") diff --git a/py/util.py b/py/util.py index 50ca91d..7b8036b 100644 --- a/py/util.py +++ b/py/util.py @@ -12,9 +12,9 @@ def get_day_with_suffix(day): def format_today(): """Format the current datetime""" now = datetime.now() - day = get_day_with_suffix(now.day) - month = now.strftime("%B") - return f"{day} {month}" + num = get_day_with_suffix(now.day) + day = now.strftime("%a") + return f"{day} {num}" def format_list(list) -> str: