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
|
@dataclass
|
||||||
class Alert:
|
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
|
title: str
|
||||||
body: str
|
body: str
|
||||||
image_path: Path | None = None # annotated screenshot
|
image_path: Path | None = None # annotated screenshot
|
||||||
direction: str | None = None # "BUY"/"SELL" when kind=trigger
|
direction: str | None = None # "BUY"/"SELL" when kind=trigger
|
||||||
|
silent: bool = False # disable_notification for Telegram; ignored by Discord
|
||||||
|
|
||||||
|
|
||||||
class Notifier(Protocol):
|
class Notifier(Protocol):
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ class TelegramNotifier:
|
|||||||
"chat_id": self._chat_id,
|
"chat_id": self._chat_id,
|
||||||
"caption": text,
|
"caption": text,
|
||||||
"parse_mode": "HTML",
|
"parse_mode": "HTML",
|
||||||
|
"disable_notification": str(alert.silent).lower(),
|
||||||
},
|
},
|
||||||
files={"photo": fh},
|
files={"photo": fh},
|
||||||
timeout=10,
|
timeout=10,
|
||||||
@@ -44,6 +45,7 @@ class TelegramNotifier:
|
|||||||
"chat_id": self._chat_id,
|
"chat_id": self._chat_id,
|
||||||
"text": text,
|
"text": text,
|
||||||
"parse_mode": "HTML",
|
"parse_mode": "HTML",
|
||||||
|
"disable_notification": alert.silent,
|
||||||
},
|
},
|
||||||
timeout=10,
|
timeout=10,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user