[docs]classRankcard(BaseImageModel):"""Represents a rank card."""__endpoint__=Premium.RANK_CARDtemplate:Literal[1,2,3,4,5,6,7,8,9]"""The template to use. Must be a number between 1 and 9. .. versionadded:: 0.1.0 """username:str=attribute(max_length=32)"""The username of the user. Max 32 characters."""avatar_url:str=attribute(data_name="avatar")"""The avatar URL of the user. Must be .png or .jpg."""level:int"""The current level of the user."""current_xp:int=attribute(data_name="cxp")"""The current XP of the user."""needed_xp:int=attribute(data_name="nxp")"""The needed XP to level up."""discriminator:int|None=attribute(default=None,min_length=1,max_length=4,forced_type=str)"""The discriminator of the user. Will be stripped if equal to 0 """background_url:str|None=attribute(default=None,data_name="bg")"""The custom background of the rank card as url. Tier 2+ key required. This cannot be used with background_color. """background_color:str|None=attribute(default=None,data_name="cbg")"""The custom background color of the rank card. Tier 1+ key required. Can put "random" to get a random color. This cannot be used with background. """text_color:str|None=attribute(default=None,data_name="ctext")"""The custom text color of the rank card as hex. Can put "random" to get a random color. """current_xp_color:str|None=attribute(default=None,data_name="ccxp")"""The color of the current XP as hex. Can put "random" to get a random color. """xp_bar_color:str|None=attribute(default=None,data_name="cbar")"""The color of the XP bar as hex. Can put "random" to get a random color. """username_color:str|None=attribute(default=None,data_name="ctag")"""The color of the username as hex. Can put "random" to get a random color. .. versionadded:: 0.1.0 """def__post_init__(self)->None:COLOR_ERROR="Invalid {0} color. Must be a valid hex color or 'random'. Valid formats: '#000000', 0x000000, 000000"ifself.background_colorisnotNone:ifnot(color:=_utils._check_colour_value(self.background_color)):raiseValueError(COLOR_ERROR.format("background"))self.background_color=colorifself.text_colorisnotNone:ifnot(color:=_utils._check_colour_value(self.text_color)):raiseValueError(COLOR_ERROR.format("text"))self.text_color=colorifself.current_xp_colorisnotNone:ifnot(color:=_utils._check_colour_value(self.current_xp_color)):raiseValueError(COLOR_ERROR.format("current xp"))self.current_xp_color=colorifself.xp_bar_colorisnotNone:ifnot(color:=_utils._check_colour_value(self.xp_bar_color)):raiseValueError(COLOR_ERROR.format("xp bar"))self.xp_bar_color=colorifself.username_colorisnotNone:ifnot(color:=_utils._check_colour_value(self.username_color)):raiseValueError(COLOR_ERROR.format("username"))self.username_color=colorsuper().__post_init__()