diff --git a/src/bot.py b/src/bot.py index 77a01d4..d8a3081 100644 --- a/src/bot.py +++ b/src/bot.py @@ -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, diff --git a/src/webhooks.py b/src/webhooks.py index 9d223ee..be24fc7 100644 --- a/src/webhooks.py +++ b/src/webhooks.py @@ -198,7 +198,11 @@ 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"], @@ -206,7 +210,7 @@ async def organization_member_invited(self, payload: ClientPayload): 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}}}", ) @@ -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}", )