Skip to content

Commit

Permalink
Added telegram notifier option only_reservations #482
Browse files Browse the repository at this point in the history
  • Loading branch information
Der-Henning committed May 9, 2024
1 parent b59208f commit cae597c
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 58 deletions.
106 changes: 53 additions & 53 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions tgtg_scanner/models/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ class TelegramConfig(NotifierConfig):
token: Union[str, None] = None
chat_ids: list[str] = field(default_factory=list)
disable_commands: bool = False
only_reservations: bool = False
timeout: int = 60
body: str = (
"*${{display_name}}*\n*Available*: ${{items_available}}\n*Price*: ${{price}} ${{currency}}\n*Pickup*: ${{pickupdate}}"
Expand All @@ -180,6 +181,7 @@ def _read_ini(self, parser: configparser.ConfigParser):
self._ini_get_list(parser, "TELEGRAM", "chat_ids", "chat_ids") # legacy support
self._ini_get_list(parser, "TELEGRAM", "ChatIDs", "chat_ids")
self._ini_get_boolean(parser, "TELEGRAM", "DisableCommands", "disable_commands")
self._ini_get_boolean(parser, "TELEGRAM", "OnlyReservations", "only_reservations")
self._ini_get_int(parser, "TELEGRAM", "Timeout", "timeout")
self._ini_get(parser, "TELEGRAM", "Body", "body")
self._ini_get(parser, "TELEGRAM", "Image", "image")
Expand All @@ -190,6 +192,7 @@ def _read_env(self):
self._env_get("TELEGRAM_TOKEN", "token")
self._env_get_list("TELEGRAM_CHAT_IDS", "chat_ids")
self._env_get_boolean("TELEGRAM_DISABLE_COMMANDS", "disable_commands")
self._env_get_boolean("TELEGRAM_ONLY_RESERVATIONS", "only_reservations")
self._env_get_int("TELEGRAM_TIMEOUT", "timeout")
self._env_get("TELEGRAM_BODY", "body")
self._env_get("TELEGRAM_IMAGE", "image")
Expand Down
Loading

0 comments on commit cae597c

Please sign in to comment.