diff --git a/configs/config.py b/configs/config.py index 372b3d7..01b8173 100644 --- a/configs/config.py +++ b/configs/config.py @@ -34,6 +34,7 @@ class Config: def __init__(self): self.parser = self.get_argument_parser() self.folder = "" + self.is_docker = bool(os.environ.get("IS_DOCKER", 0)) def parse(self): self.args = self.parser.parse_args() @@ -152,7 +153,8 @@ class Config: self.telegram_config = TelethonConfig( api_id=secrets["telegram"]["api_id"], api_hash=secrets["telegram"]["api_hash"], - bot_token=secrets["telegram"].get("bot_token", None) + bot_token=secrets["telegram"].get("bot_token", None), + session_file=secrets["telegram"].get("session_file", "./anon") ) else: self.telegram_config = None @@ -175,7 +177,8 @@ class Config: if "vk" in secrets: self.vk_config = VkConfig( username=secrets["vk"]["username"], - password=secrets["vk"]["password"] + password=secrets["vk"]["password"], + session_file=secrets["vk"].get("session_file", "./vk_config.v2.json") ) else: self.vk_config = None diff --git a/configs/telethon_config.py b/configs/telethon_config.py index 3099bb5..111c7bd 100644 --- a/configs/telethon_config.py +++ b/configs/telethon_config.py @@ -7,3 +7,4 @@ class TelethonConfig: api_id: str api_hash: str bot_token: str + session_file: str diff --git a/configs/vk_config.py b/configs/vk_config.py index db2e61c..4c3472c 100644 --- a/configs/vk_config.py +++ b/configs/vk_config.py @@ -6,3 +6,4 @@ from dataclasses import dataclass class VkConfig: username: str password: str + session_file: str diff --git a/example.config.yaml b/example.config.yaml index c6ad8f8..857265b 100644 --- a/example.config.yaml +++ b/example.config.yaml @@ -50,6 +50,8 @@ secrets: api_hash: your API hash # optional, but allows access to more content such as large videos, talk to @botfather bot_token: your bot-token + # optional, defaults to ./anon, records the telegram login session for future usage + session_file: "secrets/anon" # twitter configuration - API V2 only # if you don't provide credentials the less-effective unofficial TwitterArchiver will be used instead @@ -66,6 +68,8 @@ secrets: vk: username: "phone number or email" password: "password" + # optional, defaults to ./vk_config.v2.json, records VK login session for future usage + session_file: "secrets/vk_config.v2.json" # instagram credentials instagram: