Source code for twtb.logic.telegram.config

"""Module for Telegram-relative settings."""
import abc
import dataclasses
import typing as t


@dataclasses.dataclass
[docs]class ClientOrBotSection(abc.ABC): """Base class for client and bot sections."""
[docs] api_id: int = "???" # type: ignore[assignment]
[docs] api_hash: str = "???"
@dataclasses.dataclass
[docs]class ClientSection(ClientOrBotSection): """Config for client specific settings."""
[docs] phone: str = "???"
[docs] password: t.Optional[str] = None
@dataclasses.dataclass
[docs]class BotSection(ClientOrBotSection): """Config for bot specific settings."""
[docs] bot_token: str = "???"
@dataclasses.dataclass
[docs]class TelegramConfigSection: """Config for telegram specific settings."""
[docs] client: ClientSection = dataclasses.field(default_factory=ClientSection)
[docs] bot: BotSection = dataclasses.field(default_factory=BotSection)