Skip to content

Commit

Permalink
Add webhooks for leadership organization
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrxyz committed Aug 22, 2024
1 parent 043fa46 commit 9d287b2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,13 @@ class MILBot(commands.Bot):
member_services_channel: discord.TextChannel
errors_channel: discord.TextChannel
software_github_channel: discord.TextChannel
electrical_github_channel: discord.TextChannel
mechanical_github_channel: discord.TextChannel
leads_github_channel: discord.TextChannel
software_projects_channel: discord.TextChannel
mechanical_category_channel: discord.CategoryChannel
electrical_category_channel: discord.CategoryChannel
leaders_category_channel: discord.CategoryChannel
software_category_channel: discord.CategoryChannel
operations_leaders_channel: discord.TextChannel
software_leaders_channel: discord.TextChannel
Expand Down Expand Up @@ -327,6 +331,13 @@ async def fetch_vars(self) -> None:
assert isinstance(electrical_category_channel, discord.CategoryChannel)
self.electrical_category_channel = electrical_category_channel

leads_category_channel = discord.utils.get(
self.active_guild.categories,
name="Leadership",
)
assert isinstance(leads_category_channel, discord.CategoryChannel)
self.leads_category_channel = leads_category_channel

mechanical_category_channel = discord.utils.get(
self.active_guild.categories,
name="Mechanical",
Expand Down Expand Up @@ -358,6 +369,14 @@ async def fetch_vars(self) -> None:
assert isinstance(mech_github_updates_channel, discord.TextChannel)
self.mechanical_github_channel = mech_github_updates_channel

leads_github_updates_channel = discord.utils.get(
self.active_guild.text_channels,
name="github-updates",
category=self.leads_category_channel,
)
assert isinstance(leads_github_updates_channel, discord.TextChannel)
self.leads_github_channel = leads_github_updates_channel

errors_channel = discord.utils.get(
self.active_guild.text_channels,
name="bot-errors",
Expand Down
6 changes: 6 additions & 0 deletions src/webhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ def updates_channel(self, repository_or_login: dict | str) -> discord.TextChanne
return self.bot.electrical_github_channel
if login.startswith("uf-mil-mechanical"):
return self.bot.mechanical_github_channel
if login.startswith("uf-mil-leadership"):
return self.bot.leads_github_channel
return self.bot.software_github_channel

def leaders_channel(self, repository_or_login: dict | str) -> discord.TextChannel:
Expand All @@ -99,13 +101,17 @@ def leaders_channel(self, repository_or_login: dict | str) -> discord.TextChanne
return self.bot.electrical_leaders_channel
if login.startswith("uf-mil-mechanical"):
return self.bot.mechanical_leaders_channel
if login.startswith("uf-mil-leadership"):
return self.bot.leads_github_channel
return self.bot.software_leaders_channel

def category_channel(self, login: str) -> discord.CategoryChannel:
if login.startswith("uf-mil-electrical"):
return self.bot.electrical_category_channel
if login.startswith("uf-mil-mechanical"):
return self.bot.mechanical_category_channel
if login.startswith("uf-mil-leadership"):
return self.bot.leads_category_channel
return self.bot.software_category_channel

def notify_channels(self, labels: list[dict]) -> list[discord.TextChannel]:
Expand Down

0 comments on commit 9d287b2

Please sign in to comment.