fixes
This commit is contained in:
@@ -130,15 +130,18 @@ class EnumMember(object):
|
||||
return hash(self.value)
|
||||
|
||||
def localized(self, lang: str = None) -> str:
|
||||
if self.loc_obj and len(self.loc_obj) > 0:
|
||||
if lang and lang in self.loc_obj.keys():
|
||||
return self.loc_obj[lang]
|
||||
else:
|
||||
if self.loc_obj:
|
||||
if not lang:
|
||||
i18n = I18n.get_current()
|
||||
if i18n:
|
||||
return self.loc_obj[i18n.current_locale]
|
||||
lang = i18n.current_locale
|
||||
else:
|
||||
return self.loc_obj[list(self.loc_obj.keys())[0]]
|
||||
lang = list(self.loc_obj.keys())[0]
|
||||
|
||||
if lang in self.loc_obj.keys():
|
||||
return self.loc_obj[lang]
|
||||
else:
|
||||
return self.loc_obj[list(self.loc_obj.keys())[0]]
|
||||
|
||||
return self.value
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ class UserBase(BotEntity, table=False):
|
||||
lang: LanguageBase = Field(sa_type=EnumType(LanguageBase), default=LanguageBase.EN)
|
||||
is_active: bool = True
|
||||
|
||||
name: str
|
||||
|
||||
roles: list[RoleBase] = Field(
|
||||
sa_type=ARRAY(EnumType(RoleBase)), default=[RoleBase.DEFAULT_USER]
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user