Skip to content

Commit

Permalink
work
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrxyz committed Aug 10, 2024
1 parent f77ebbf commit 227786f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ async def fetch_vars(self) -> None:
name="mechanical-leadership",
)
assert isinstance(mechanical_leaders_channel, discord.TextChannel)
self.electrical_leaders_channel = mechanical_leaders_channel
self.mechanical_leaders_channel = mechanical_leaders_channel

software_category_channel = discord.utils.get(
self.active_guild.categories,
Expand Down
12 changes: 8 additions & 4 deletions src/webhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,19 @@ async def organization_member_invited(self, payload: ClientPayload):
# Send a message to software-leadership in the form of:
# [User A](link) invited [User B](link) to [organization_name](link) in the following teams: {Team A, Team B}
name = f"[{await self.real_name(gh['sender']['login'])}]({self.url(gh['sender'], html=True)})"
invited = f"[{await self.real_name(gh['user']['login'])}]({self.url(gh['user'], html=True)})"
invited = (
f"[{await self.real_name(gh['user']['login'])}]({self.url(gh['user'], html=True)})"
if "user" in gh
else gh["email"]
)
org = f"[{gh['organization']['login']}]({self.url(gh['organization'])})"
teams_resp = await self.bot.github.fetch(
gh["invitation"]["invitation_teams_url"],
)
teams = ", ".join(
[f"[{team['name']}]({self.url(team, html=True)})" for team in teams_resp],
)
updates_channel = self.updates_channel(gh["organization"]["login"])
updates_channel = self.leaders_channel(gh["organization"]["login"])
await updates_channel.send(
f"{name} invited {invited} to {org} in the following teams: {{{teams}}}",
)
Expand All @@ -216,9 +220,9 @@ async def organization_member_added(self, payload: ClientPayload):
gh = payload.github_data
# Send a message to software-leadership in the form of:
# [User A](link) accepted an invitation to join [organization_name](link)
name = f"[{await self.real_name(gh['sender']['login'])}]({self.url(gh['sender'], html=True)})"
name = f"[{await self.real_name(gh['member']['login'])}]({self.url(gh['member'], html=True)})"
org = f"[{gh['organization']['login']}]({self.url(gh['organization'])})"
updates_channel = self.updates_channel(gh["organization"]["login"])
updates_channel = self.leaders_channel(gh["organization"]["login"])
await updates_channel.send(
f"{name} accepted an invitation to join {org}",
)
Expand Down

0 comments on commit 227786f

Please sign in to comment.