Get table names from data. Update post scores to use HighscoresData class.
This commit is contained in:
@@ -112,7 +112,7 @@ class HighscoresData:
|
||||
@param table: table to get category data from
|
||||
@returns: list of tuples containing all category and relative score data.
|
||||
"""
|
||||
return self._data[str(guild_id)][table]["categories"].items()
|
||||
return self._data[str(guild_id)]["tables"][table]["categories"].items()
|
||||
|
||||
def get_config_highscore_size(self) -> int:
|
||||
"""
|
||||
@@ -149,6 +149,22 @@ class HighscoresData:
|
||||
"""
|
||||
return self._data[str(guild_id)]["tables"][table]["message_id"]
|
||||
|
||||
def get_table_names(self, guild_id) -> "list[str]":
|
||||
"""
|
||||
Returns a list of table names.
|
||||
|
||||
@param guild_id: guild id to retrieve from.
|
||||
@returns: list of table names
|
||||
"""
|
||||
tables: "list[str]" = []
|
||||
|
||||
for table, data in self._data[str(guild_id)][ # pylint: disable=unused-variable
|
||||
"tables"
|
||||
].items():
|
||||
tables.append(table)
|
||||
|
||||
return tables
|
||||
|
||||
def remove_guild(self, guild_id: int, guild_name: str) -> None:
|
||||
"""
|
||||
Removes a guild's data from object. Saves backup.
|
||||
|
||||
Reference in New Issue
Block a user