Move message map creation to highscores.py. Was a circular import.
This commit is contained in:
@@ -122,6 +122,19 @@ class HighscoresData:
|
||||
"""
|
||||
return self._config["highscore_size"]
|
||||
|
||||
def get_guilds(self) -> "list[int]":
|
||||
"""
|
||||
Gets a list of guilds tracked by data
|
||||
|
||||
@returns: list of ints representing guild ids
|
||||
"""
|
||||
guilds: "list[int]" = []
|
||||
|
||||
for guild, data in self._data: # pylint: disable=unused-variable
|
||||
guilds.append(int(guild))
|
||||
|
||||
return guilds
|
||||
|
||||
def get_guild_channel_id(self, guild_id: int) -> int:
|
||||
"""
|
||||
Returns the channel id to post highscore messages to.
|
||||
|
||||
@@ -7,25 +7,6 @@ from highscores import highscores_data # pylint: disable=import-error
|
||||
from highscores import highscores_message_map # pylint: disable=import-error
|
||||
|
||||
|
||||
def create_message_map(data: dict):
|
||||
"""
|
||||
Creates a message map from input highscores data.
|
||||
|
||||
@param data: highscores_data dict to create map from.
|
||||
@return: dict message_map of message to boss.
|
||||
"""
|
||||
|
||||
message_map = {}
|
||||
|
||||
# guild id will be a string. Json object keys are strings.
|
||||
for guild, guild_scores in data.items():
|
||||
message_map[guild] = {}
|
||||
for boss, info in guild_scores["tables"].items():
|
||||
message_map[guild][info["message_id"]] = boss
|
||||
|
||||
return message_map
|
||||
|
||||
|
||||
def format_highscore_message(boss_name: str, guild_id: int):
|
||||
"""
|
||||
returns a formatted string for a boss's highscore
|
||||
|
||||
Reference in New Issue
Block a user