Update highscores.py to use new data classes.

This commit is contained in:
alwayscompiling
2022-08-02 16:41:46 -04:00
parent 2dc0350213
commit 251ac2cf47
2 changed files with 13 additions and 4 deletions
+9
View File
@@ -38,6 +38,15 @@ class HighscoresData:
data[guild_id] = guild_obj.to_dict()
return "Highscores Data\n" + json.dumps(data, indent=4)
@property
def guilds(self) -> "list[Guild]":
"""
Getter for Guilds list.
Returns:
list[Guild]: List of Guilds tracked by Highscores Bot
"""
def add_guild(self, guild_id: int) -> None:
"""
Creates a new Guild and adds to Guild map.
+4 -4
View File
@@ -22,10 +22,10 @@ logger.addHandler(handler)
highscores_data: HighscoresData = HighscoresData()
highscores_message_map = {}
for guild in highscores_data.get_guilds():
highscores_message_map[guild] = {}
for table in highscores_data.get_table_names(guild):
message_id = highscores_data.get_table_message_id(guild, table)
for guild in highscores_data.guilds:
highscores_message_map[guild.guild_id] = {}
for table in guild.tables:
message_id = table.message_id
highscores_message_map[guild][message_id] = table
submission_objects: dict = {}