Move create_message_map to here.
This commit is contained in:
+20
-1
@@ -6,7 +6,26 @@ import nextcord
|
|||||||
from highscores import highscores_config # pylint: disable=import-error
|
from highscores import highscores_config # pylint: disable=import-error
|
||||||
from highscores import highscores_data # pylint: disable=import-error
|
from highscores import highscores_data # pylint: disable=import-error
|
||||||
from highscores import highscores_message_map # pylint: disable=import-error
|
from highscores import highscores_message_map # pylint: disable=import-error
|
||||||
from utilities.data_storage import save_highscores_data # pylint: disable=import-error
|
from utilities.highscores_data import save_highscores_data # 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_data: dict):
|
def format_highscore_message(boss_name: str, guild_data: dict):
|
||||||
|
|||||||
Reference in New Issue
Block a user