Add set_language function

This commit is contained in:
M-307 2022-07-18 15:54:24 +07:00
parent 028fc1eab6
commit 066bf210de

View File

@ -8,6 +8,7 @@ from .model import EnkaNetworkResponse
from .exception import VaildateUIDError, UIDNotFounded
from .assets import Assets
from .utils import create_path, validate_uid, request
from .enum import Language
class EnkaNetworkAPI:
LOGGER = logging.getLogger(__name__)
@ -26,6 +27,17 @@ class EnkaNetworkAPI:
# Key
self.__key = key
@property
def lang(self) -> Language:
return self.assets.LANGS
@lang.setter
def lang(self, lang: Language) -> None:
self.assets._set_language(lang)
async def set_language(self, lang: Language) -> None:
self.lang = lang
async def fetch_user(self, uid: Union[str, int]) -> EnkaNetworkResponse:
self.LOGGER.debug(f"Validating with UID {uid}...")
if not validate_uid(str(uid)):