feat(notifier): Alert.silent + TelegramNotifier disable_notification
Silent screenshots for periodic auto-poll — Telegram param disable_notification=True suppresses phone notification sound. Discord ignores the field (no equivalent). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,11 +5,13 @@ from typing import Protocol
|
||||
|
||||
@dataclass
|
||||
class Alert:
|
||||
kind: str # "trigger" | "heartbeat" | "levels" | "warn" | "arm" | "prime" | "late_start"
|
||||
# flat union: "trigger"|"heartbeat"|"levels"|"warn"|"arm"|"prime"|"late_start"|"screenshot"|"status"
|
||||
kind: str
|
||||
title: str
|
||||
body: str
|
||||
image_path: Path | None = None # annotated screenshot
|
||||
direction: str | None = None # "BUY"/"SELL" when kind=trigger
|
||||
silent: bool = False # disable_notification for Telegram; ignored by Discord
|
||||
|
||||
|
||||
class Notifier(Protocol):
|
||||
|
||||
@@ -33,6 +33,7 @@ class TelegramNotifier:
|
||||
"chat_id": self._chat_id,
|
||||
"caption": text,
|
||||
"parse_mode": "HTML",
|
||||
"disable_notification": str(alert.silent).lower(),
|
||||
},
|
||||
files={"photo": fh},
|
||||
timeout=10,
|
||||
@@ -44,6 +45,7 @@ class TelegramNotifier:
|
||||
"chat_id": self._chat_id,
|
||||
"text": text,
|
||||
"parse_mode": "HTML",
|
||||
"disable_notification": alert.silent,
|
||||
},
|
||||
timeout=10,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user