Skip to content

Commit

Permalink
feat: Send one message per channel, add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
1ukastesar committed Apr 11, 2024
1 parent 8c1c327 commit 001cf21
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions cogs/fitwide/cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,11 @@ async def generate_vyucujici_info(self, inter: disnake.ApplicationCommandInterac
for semester_name in features.CATEGORIES_NAMES
]

# TODO remove in production
# Remove None values
categories = [category for category in categories if category is not None]

# Check if all categories were found
if None in categories:
await inter.edit_original_response(MessagesCZ.gen_teacher_info_inv_catg)
return
Expand All @@ -530,6 +533,7 @@ async def generate_vyucujici_info(self, inter: disnake.ApplicationCommandInterac
await inter.edit_original_response(MessagesCZ.gen_teacher_info_channel_none)
return

# Clear channel before sending new data
await teacher_info_channel.purge()
await teacher_info_channel.send(MessagesCZ.gen_teacher_info_header)

Expand All @@ -555,10 +559,11 @@ async def generate_vyucujici_info(self, inter: disnake.ApplicationCommandInterac

channel_teachers.append(user)

# TODO send one message per channel for easier management
if channel_teachers:
await teacher_info_channel.send(f"**{channel.name.upper()}:**")
message = f"**{channel.name.upper()}:**\n"
for teacher in channel_teachers:
await teacher_info_channel.send(f"- {teacher.mention}")
# TODO add teacher's full name
message += f"- {teacher.mention}\n"
await teacher_info_channel.send(message)

await inter.edit_original_response(MessagesCZ.gen_teacher_info_success)

0 comments on commit 001cf21

Please sign in to comment.