Skip to content

Commit

Permalink
Update statistics_check.py
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahCxrest authored Jan 7, 2025
1 parent cffa993 commit 8de49e8
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions tasks/statistics_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
from utils.prc_api import Player, ServerStatus
from utils.utils import fetch_get_channel

async def update_channel(guild, stat_config, placeholders):
async def update_channel(guild, channel_id, stat_config, placeholders):
try:
channel_id = stat_config["channel"]
format_string = stat_config["format"]
channel = await fetch_get_channel(guild, channel_id)
channel = await fetch_get_channel(guild, int(channel_id))
if channel:
format_string = stat_config["format"]
for key, value in placeholders.items():
format_string = format_string.replace(f"{{{key}}}", str(value))
await channel.edit(name=format_string)
Expand Down Expand Up @@ -69,8 +68,8 @@ async def statistics_check(bot):
"queue": queue
}

tasks = [update_channel(guild, stat_value, placeholders)
for stat_name, stat_value in statistics.items()]
tasks = [update_channel(guild, channel_id, stat_config, placeholders)
for channel_id, stat_config in statistics.items()]
await asyncio.gather(*tasks)

end_time = time.time()
Expand Down

0 comments on commit 8de49e8

Please sign in to comment.