Skip to content

Commit

Permalink
add members with welcome role to the #ahoj thread
Browse files Browse the repository at this point in the history
  • Loading branch information
honzajavorek committed May 23, 2023
1 parent c966fda commit 6ea7229
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions juniorguru_chick/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
DAYS = ["Pondělní", "Úterní", "Středeční",
"Čtvrteční", "Páteční", "Sobotní", "Nedělní"]

WELCOME_ROLE_ID = 1062755787153358879


logger = logging.getLogger("chick.bot")

Expand Down Expand Up @@ -65,6 +67,7 @@ async def on_thread_create(thread: discord.Thread) -> None:

if channel_name == "ahoj":
await asyncio.gather(ensure_thread_name(thread, "Ahoj {author}!"),
add_members_with_role(thread, WELCOME_ROLE_ID),
starting_message.add_reaction("👋"),
starting_message.add_reaction("🐣"),
starting_message.add_reaction("👍"))
Expand Down Expand Up @@ -109,3 +112,8 @@ async def ensure_thread_name(thread: discord.Thread, name_template) -> str | Non
return name
else:
return None


async def add_members_with_role(thread: discord.Thread, role_id: int) -> None:
"""Adds members of given role to given thread"""
await thread.send(f"<@&{role_id}>", delete_after=0, silent=True)

0 comments on commit 6ea7229

Please sign in to comment.