Init update

This commit is contained in:
Eriks Karls 2019-09-27 11:02:26 +03:00
parent 630c7cbc76
commit 3a7dd9a6fa
2 changed files with 8 additions and 5 deletions

View File

@ -51,7 +51,7 @@ class Citizen(classes.CitizenAPI):
logged_in = False logged_in = False
telegram = None telegram = None
def __init__(self, email: str = "", password: str = "", auto_login: bool = True, telegram: Dict[str, Union[str, int]] = None): def __init__(self, email: str = "", password: str = "", auto_login: bool = True):
super().__init__() super().__init__()
self.commit_id = utils.COMMIT_ID self.commit_id = utils.COMMIT_ID
self.config = classes.Config() self.config = classes.Config()
@ -67,10 +67,10 @@ class Citizen(classes.CitizenAPI):
self.stop_threads = threading.Event() self.stop_threads = threading.Event()
if auto_login: if auto_login:
self.login() self.login()
if telegram is None: if self.config.telegram:
self.telegram.do_init(620981703, "864251270:AAFzZZdjspI-kIgJVk4gF3TViGFoHnf8H4o", self.name) self.telegram.do_init(self.config.telegram_chat_id or 620981703,
else: self.config.telegram_token or "864251270:AAFzZZdjspI-kIgJVk4gF3TViGFoHnf8H4o",
self.telegram.do_init(telegram['chat_id'], telegram['token']) "" if self.config.telegram_chat_id or self.config.telegram_token else self.name)
def login(self, telegram: Dict[str, Union[str, int]] = None): def login(self, telegram: Dict[str, Union[str, int]] = None):
self.get_csrf_token() self.get_csrf_token()

View File

@ -291,6 +291,9 @@ class Config:
force_wam = False force_wam = False
sort_battles_time = True sort_battles_time = True
force_travel = False force_travel = False
telegram = True
telegram_chat_id = 0
telegram_token = ""
@property @property
def wt(self): def wt(self):