From e90c128dcaabaf57fd2fdd1a43617de2041351ca Mon Sep 17 00:00:00 2001 From: "alexei.dolgolyov" Date: Sun, 22 Mar 2026 23:04:33 +0300 Subject: [PATCH] fix: pass chat_action from target config to Telegram client chat_action was stored on NotificationTarget model but never injected into the config dict passed to the dispatcher. Now injected in both watcher and webhook handler, and read by the dispatcher to pass to TelegramClient.send_notification(). --- .../core/src/notify_bridge_core/notifications/dispatcher.py | 2 ++ packages/server/src/notify_bridge_server/api/webhooks.py | 3 +++ packages/server/src/notify_bridge_server/services/watcher.py | 3 +++ 3 files changed, 8 insertions(+) diff --git a/packages/core/src/notify_bridge_core/notifications/dispatcher.py b/packages/core/src/notify_bridge_core/notifications/dispatcher.py index 4ce2a46..3cfc8b4 100644 --- a/packages/core/src/notify_bridge_core/notifications/dispatcher.py +++ b/packages/core/src/notify_bridge_core/notifications/dispatcher.py @@ -105,6 +105,7 @@ class NotificationDispatcher: ) -> dict[str, Any]: bot_token = target.config.get("bot_token") disable_preview = target.config.get("disable_url_preview", False) + chat_action = target.config.get("chat_action", "typing") max_media = target.config.get("max_media_to_send", 50) max_group = target.config.get("max_media_per_group", 10) chunk_delay = target.config.get("media_delay", 500) @@ -172,6 +173,7 @@ class NotificationDispatcher: chunk_delay=chunk_delay, max_asset_data_size=max_size, send_large_photos_as_documents=send_large_as_docs, + chat_action=chat_action or None, ) if not media_result.get("success"): _LOGGER.warning("Text sent OK but media failed for chat %s: %s", chat_id, media_result.get("error")) diff --git a/packages/server/src/notify_bridge_server/api/webhooks.py b/packages/server/src/notify_bridge_server/api/webhooks.py index 0404647..98d3e5d 100644 --- a/packages/server/src/notify_bridge_server/api/webhooks.py +++ b/packages/server/src/notify_bridge_server/api/webhooks.py @@ -229,6 +229,9 @@ async def _load_link_data( template_slots[event_key] = tmpl_text target_config = dict(target.config) + # Inject chat_action for Telegram targets + if hasattr(target, 'chat_action') and target.chat_action: + target_config["chat_action"] = target.chat_action # Inject bot credentials if target.type == "email": email_bot_id = target.config.get("email_bot_id") diff --git a/packages/server/src/notify_bridge_server/services/watcher.py b/packages/server/src/notify_bridge_server/services/watcher.py index 51ac874..e657930 100644 --- a/packages/server/src/notify_bridge_server/services/watcher.py +++ b/packages/server/src/notify_bridge_server/services/watcher.py @@ -176,6 +176,9 @@ async def check_tracker(tracker_id: int) -> dict[str, Any]: template_slots[event_key] = tmpl_text target_config = dict(target.config) + # Inject chat_action for Telegram targets + if hasattr(target, 'chat_action') and target.chat_action: + target_config["chat_action"] = target.chat_action # Inject bot credentials for bot-backed target types if target.type == "email": email_bot_id = target.config.get("email_bot_id")