Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions bot/extensions/welcome_cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __init__(self, bot):
self.bot = bot

@property
def help_section(self):
def help_section(self) -> str:
return self.__build_section(
["posting_guidelines", "help", "resources"],
"### Looking for help?\n"
Expand All @@ -26,7 +26,7 @@ def help_section(self):
)

@property
def project_section(self):
def project_section(self) -> str:
return self.__build_section(
["code-society-lab"],
"### Looking for projects?\n"
Expand All @@ -37,7 +37,15 @@ def project_section(self):
"- [Matrix.py](<https://github.com/Code-Society-Lab/matrixpy>)\n",
)

def get_welcome_message(self, member: Member):
@property
def matrix_section(self) -> str:
return self.__build_section(
[],
"### Join our Matrix Server!\n"
"You can also join our [matrix server](<https://matrix.to/#/%23codesociety:matrix.org>)"
)

def get_welcome_message(self, member: Member) -> str:
"""Return the welcome message for the given member.

:param member: The member to welcome.
Expand All @@ -54,14 +62,15 @@ def get_welcome_message(self, member: Member):
self.BASE_WELCOME_MESSAGE,
self.help_section,
self.project_section,
self.matrix_section,
],
)
)
.strip()
.format(member_name=member.display_name)
)

def __build_section(self, channel_names, message):
def __build_section(self, channel_names: list[str], message: str):
"""Builds a section of the welcome message by replacing
placeholders with corresponding channel IDs.

Expand Down
Loading