Update highscores.py to use new data classes.
This commit is contained in:
@@ -38,6 +38,15 @@ class HighscoresData:
|
|||||||
data[guild_id] = guild_obj.to_dict()
|
data[guild_id] = guild_obj.to_dict()
|
||||||
return "Highscores Data\n" + json.dumps(data, indent=4)
|
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:
|
def add_guild(self, guild_id: int) -> None:
|
||||||
"""
|
"""
|
||||||
Creates a new Guild and adds to Guild map.
|
Creates a new Guild and adds to Guild map.
|
||||||
|
|||||||
+4
-4
@@ -22,10 +22,10 @@ logger.addHandler(handler)
|
|||||||
highscores_data: HighscoresData = HighscoresData()
|
highscores_data: HighscoresData = HighscoresData()
|
||||||
highscores_message_map = {}
|
highscores_message_map = {}
|
||||||
|
|
||||||
for guild in highscores_data.get_guilds():
|
for guild in highscores_data.guilds:
|
||||||
highscores_message_map[guild] = {}
|
highscores_message_map[guild.guild_id] = {}
|
||||||
for table in highscores_data.get_table_names(guild):
|
for table in guild.tables:
|
||||||
message_id = highscores_data.get_table_message_id(guild, table)
|
message_id = table.message_id
|
||||||
highscores_message_map[guild][message_id] = table
|
highscores_message_map[guild][message_id] = table
|
||||||
|
|
||||||
submission_objects: dict = {}
|
submission_objects: dict = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user