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: def id(self) -> int:
pass pass
@property
def display_name(self) -> str:
pass
@property @property
def roles(self) -> list[Role]: def roles(self) -> list[Role]:
pass 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 # 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: if intrctn.channel.permissions_for(intrctn.guild.me).create_public_threads:
await intrctn.channel.create_thread( 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, message=message,
reason="Creating a matching thread") reason="Creating a matching thread")

View file

@ -12,9 +12,9 @@ def get_day_with_suffix(day):
def format_today(): def format_today():
"""Format the current datetime""" """Format the current datetime"""
now = datetime.now() now = datetime.now()
day = get_day_with_suffix(now.day) num = get_day_with_suffix(now.day)
month = now.strftime("%B") day = now.strftime("%a")
return f"{day} {month}" return f"{day} {num}"
def format_list(list) -> str: def format_list(list) -> str: