Update the thread name to have the members

This commit is contained in:
Marc Di Luzio 2024-08-12 19:29:47 +01:00
parent 3ea779f7f2
commit bebef9d38a
3 changed files with 8 additions and 4 deletions

View file

@ -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

View file

@ -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")

View file

@ -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: