Add highscore size to guild class.
This commit is contained in:
+25
-1
@@ -11,13 +11,14 @@ class Guild:
|
||||
def __init__(self, guild_id: int) -> None:
|
||||
"""
|
||||
Default constructor for Guild class. Initializes channel ids as 0 as they won't be
|
||||
registered yet. Sets default username length of 12.
|
||||
registered yet. Sets default username length of 12. Default highscores size to 3.
|
||||
|
||||
Args:
|
||||
guild_id (int): Discord Guild id of new Guild
|
||||
"""
|
||||
self._guild_id: int = guild_id
|
||||
self._highscore_channel_id: int = 0
|
||||
self._highscore_size: int = 3
|
||||
self._submission_channel_id: int = 0
|
||||
self._table_map: dict = {}
|
||||
self._username_length: int = 12
|
||||
@@ -46,6 +47,7 @@ class Guild:
|
||||
"""
|
||||
guild = cls(guild_id)
|
||||
guild.highscore_channel = data["highscore_channel_id"]
|
||||
guild.highscore_size = data["highscore_size"]
|
||||
guild.submission_channel = data["submission_channel_id"]
|
||||
guild.username_length = data["username_length"]
|
||||
guild.verification_channel = data["verification_channel_id"]
|
||||
@@ -86,6 +88,27 @@ class Guild:
|
||||
"""
|
||||
self._highscore_channel_id = channel
|
||||
|
||||
@property
|
||||
def highscore_size(self) -> int:
|
||||
"""
|
||||
Getter for highscore size. How many ranks to print in each highscore message.
|
||||
|
||||
Returns:
|
||||
int: highscore size
|
||||
"""
|
||||
|
||||
@highscore_size.setter
|
||||
def highscore_size(self, size: int) -> None:
|
||||
"""
|
||||
Setter for highscore size.
|
||||
|
||||
Args:
|
||||
size (int): highscore size
|
||||
|
||||
Returns:
|
||||
_type_: _description_
|
||||
"""
|
||||
|
||||
@property
|
||||
def submission_channel(self) -> int:
|
||||
"""
|
||||
@@ -191,6 +214,7 @@ class Guild:
|
||||
data: dict = {}
|
||||
|
||||
data["highscore_channel_id"] = self.highscore_channel
|
||||
data["highscore_size"] = self.highscore_size
|
||||
data["submission_channel_id"] = self.submission_channel
|
||||
data["tables"] = {}
|
||||
data["username_length"] = self.username_length
|
||||
|
||||
@@ -330,6 +330,5 @@
|
||||
"ascending": true,
|
||||
"is_time_record": false
|
||||
}
|
||||
},
|
||||
"highscore_size": 3
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user