Message map has guild id as an int. Update submission view to use HighscoresData.
This commit is contained in:
@@ -130,19 +130,29 @@ class HighscoresData:
|
||||
"""
|
||||
guilds: "list[int]" = []
|
||||
|
||||
for guild, data in self._data: # pylint: disable=unused-variable
|
||||
for guild, data in self._data.items(): # pylint: disable=unused-variable
|
||||
guilds.append(int(guild))
|
||||
|
||||
return guilds
|
||||
|
||||
def get_guild_channel_id(self, guild_id: int) -> int:
|
||||
def get_guild_highscores_channel(self, guild_id: int) -> int:
|
||||
"""
|
||||
Returns the channel id to post highscore messages to.
|
||||
|
||||
@param guild_id: guild id to retrieve from
|
||||
@param guild_id: guild id to retrieve from.
|
||||
@returns: channel id of highscores channel.
|
||||
"""
|
||||
return self._data[str(guild_id)]["highscore_channel_id"]
|
||||
|
||||
def get_guild_submission_channel(self, guild_id: int) -> int:
|
||||
"""
|
||||
Returns the channel id to post submission messages to.
|
||||
|
||||
@param guild_id: guild id to retrieve from.
|
||||
@returns: channel id of submission channel.
|
||||
"""
|
||||
return self._data[str(guild_id)]["submission_channel_id"]
|
||||
|
||||
def get_guild_username_length(self, guild_id: int) -> int:
|
||||
"""
|
||||
Returns username length as set by each guild.
|
||||
@@ -152,12 +162,38 @@ class HighscoresData:
|
||||
"""
|
||||
return self._data[str(guild_id)]["username_length"]
|
||||
|
||||
def get_guild_verification_channel(self, guild_id: int) -> int:
|
||||
"""
|
||||
Returns the channel id to post verification messages to.
|
||||
|
||||
@param guild_id: guild id to retrieve from.
|
||||
@returns: channel id of verification channel.
|
||||
"""
|
||||
return self._data[str(guild_id)]["verification_channel_id"]
|
||||
|
||||
def get_table_categories(self, guild_id: int, table: str) -> "list[str]":
|
||||
"""
|
||||
Returns list of categories for a guild's table
|
||||
|
||||
@param guild_id: guild id to retrieve from.
|
||||
@param table: the table to retreive from.
|
||||
@returns: string list of categories in given table.
|
||||
"""
|
||||
categories: "list[str]" = []
|
||||
|
||||
for category, data in self._data[str(guild_id)][ # pylint: disable=unused-variable
|
||||
"tables"
|
||||
][table]["categories"].items():
|
||||
categories.append(category)
|
||||
|
||||
return categories
|
||||
|
||||
def get_table_message_id(self, guild_id: int, table: str) -> int:
|
||||
"""
|
||||
Returns the message id for given guild's table.
|
||||
|
||||
@param guild_id: guild id to retrieve from.
|
||||
@param table: the table to retreive from.
|
||||
@param table: the table to retrieve from.
|
||||
@returns: int id of message for table's highscores.
|
||||
"""
|
||||
return self._data[str(guild_id)]["tables"][table]["message_id"]
|
||||
|
||||
Reference in New Issue
Block a user