Skip to content

Commit

Permalink
[Hockey] Actually search for goal roles when checking goal notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
TrustyJAID committed Feb 7, 2024
1 parent c11ad0d commit 990c4fb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions hockey/hockeyset.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,14 @@ async def hockey_global_slash(self, ctx: commands.Context):
else:
self.bot.tree.remove_command("hockey")

async def check_notification_settings(self, guild: discord.Guild) -> str:
async def check_notification_settings(self, guild: discord.Guild, goal: bool = False) -> str:
reply = ""
mentionable_roles = []
non_mention_roles = []
no_role = []
for team in TEAMS:
role = discord.utils.get(guild.roles, name=team)
team_name = team if not goal else f"{team} GOAL"
role = discord.utils.get(guild.roles, name=team_name)
if not role:
no_role.append(team)
continue
Expand Down Expand Up @@ -294,7 +295,7 @@ async def set_goal_notification_style(
cur_setting = await self.config.guild(ctx.guild).goal_notifications()
verb = _("On") if cur_setting else _("Off")
reply = _("__Game State Notifications:__ **{verb}**\n\n").format(verb=verb)
reply += await self.check_notification_settings(ctx.guild)
reply += await self.check_notification_settings(ctx.guild, goal=True)
reply += _(
"No settings have been changed, run this command again "
"followed by `on` or `off` to enable/disable this setting."
Expand All @@ -304,7 +305,7 @@ async def set_goal_notification_style(
if on_off:
await self.config.guild(ctx.guild).goal_notifications.set(on_off)
reply = _("__Goal Notifications:__ **On**\n\n")
reply += await self.check_notification_settings(ctx.guild)
reply += await self.check_notification_settings(ctx.guild, goal=True)
if reply:
await ctx.maybe_send_embed(reply)
else:
Expand Down

0 comments on commit 990c4fb

Please sign in to comment.