Commit Β·
513dcc9
1
Parent(s): 32c8ed5
telegram: entire message body now rendered at 1.5x (every line an H2 heading in Rich Messages)
Browse files- CHANGELOG.md +8 -0
- local_app.py +9 -8
- modules/telegram_alert.py +7 -4
- trader/app.py +0 -0
CHANGELOG.md
CHANGED
|
@@ -94,6 +94,14 @@ All notable changes to Blind Monkeys. Format loosely follows
|
|
| 94 |
place. Secrets remain env-injected via Secret Manager; nothing sensitive
|
| 95 |
in source.
|
| 96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
### Changed (off-repo: trader service)
|
| 98 |
- **Per-grid Telegram profit messages** β grid round-trip profits are now sent
|
| 99 |
as individual Telegram messages via a 2-minute cron (`grid-profit-events` β
|
|
|
|
| 94 |
place. Secrets remain env-injected via Secret Manager; nothing sensitive
|
| 95 |
in source.
|
| 96 |
|
| 97 |
+
- **All Telegram message text enlarged to ~1.5Γ** β previously only the
|
| 98 |
+
timestamp heading was H2; now every line of every message body also renders
|
| 99 |
+
as an H2 heading in the Rich Message markdown (the only mechanism for
|
| 100 |
+
larger text β classic messages have no font-size markup). Applies to all
|
| 101 |
+
channels via the shared stamp helpers in the trader, main app, and
|
| 102 |
+
alerts module; classic fallback unchanged. Trader rev 00154, main app
|
| 103 |
+
rev 00428.
|
| 104 |
+
|
| 105 |
### Changed (off-repo: trader service)
|
| 106 |
- **Per-grid Telegram profit messages** β grid round-trip profits are now sent
|
| 107 |
as individual Telegram messages via a 2-minute cron (`grid-profit-events` β
|
local_app.py
CHANGED
|
@@ -2572,16 +2572,17 @@ def api_diagnostic():
|
|
| 2572 |
# ===================================================================
|
| 2573 |
|
| 2574 |
def _tg_stamp(text):
|
| 2575 |
-
"""
|
| 2576 |
-
|
| 2577 |
-
|
| 2578 |
-
|
| 2579 |
-
|
| 2580 |
-
breaks so line-based messages don't merge."""
|
| 2581 |
from datetime import datetime, timezone, timedelta
|
| 2582 |
stamp = datetime.now(timezone(timedelta(hours=4))).strftime("%Y-%m-%d %H:%M:%S")
|
| 2583 |
-
|
| 2584 |
-
|
|
|
|
|
|
|
| 2585 |
if len(out) > 32000:
|
| 2586 |
out = out[:32000] + "β¦"
|
| 2587 |
return out
|
|
|
|
| 2572 |
# ===================================================================
|
| 2573 |
|
| 2574 |
def _tg_stamp(text):
|
| 2575 |
+
"""Render a Telegram message at ~1.5Γ normal text size (Dean
|
| 2576 |
+
2026-11-05): each line β including the green π’ timestamp heading β
|
| 2577 |
+
becomes an H2 markdown heading in a Rich Message. Classic messages
|
| 2578 |
+
have no font-size markup, so H2 headings are the only way to enlarge
|
| 2579 |
+
text. Timestamp in Yerevan time (UTC+4)."""
|
|
|
|
| 2580 |
from datetime import datetime, timezone, timedelta
|
| 2581 |
stamp = datetime.now(timezone(timedelta(hours=4))).strftime("%Y-%m-%d %H:%M:%S")
|
| 2582 |
+
lines = ["## π’ " + stamp]
|
| 2583 |
+
for ln in text.split("\n"):
|
| 2584 |
+
lines.append("## " + ln if ln.strip() else "")
|
| 2585 |
+
out = "\n".join(lines)
|
| 2586 |
if len(out) > 32000:
|
| 2587 |
out = out[:32000] + "β¦"
|
| 2588 |
return out
|
modules/telegram_alert.py
CHANGED
|
@@ -23,13 +23,16 @@ def send_telegram_message(text: str) -> bool:
|
|
| 23 |
|
| 24 |
from datetime import datetime, timezone, timedelta
|
| 25 |
stamp = datetime.now(timezone(timedelta(hours=4))).strftime("%Y-%m-%d %H:%M:%S")
|
| 26 |
-
# Primary: Rich Message β
|
| 27 |
-
# per Dean's request 2026-11-05)
|
| 28 |
-
#
|
|
|
|
|
|
|
|
|
|
| 29 |
try:
|
| 30 |
r = requests.post(f"https://api.telegram.org/bot{token}/sendRichMessage", json={
|
| 31 |
"chat_id": chat,
|
| 32 |
-
"rich_message": {"markdown":
|
| 33 |
}, timeout=15)
|
| 34 |
if r.status_code == 200:
|
| 35 |
return True
|
|
|
|
| 23 |
|
| 24 |
from datetime import datetime, timezone, timedelta
|
| 25 |
stamp = datetime.now(timezone(timedelta(hours=4))).strftime("%Y-%m-%d %H:%M:%S")
|
| 26 |
+
# Primary: Rich Message β every line (stamp + body) rendered as an H2
|
| 27 |
+
# heading (~1.5Γ normal text size, per Dean's request 2026-11-05);
|
| 28 |
+
# classic messages have no font-size markup.
|
| 29 |
+
lines = ["## π’ " + stamp]
|
| 30 |
+
for ln in text.split("\n"):
|
| 31 |
+
lines.append("## " + ln if ln.strip() else "")
|
| 32 |
try:
|
| 33 |
r = requests.post(f"https://api.telegram.org/bot{token}/sendRichMessage", json={
|
| 34 |
"chat_id": chat,
|
| 35 |
+
"rich_message": {"markdown": "\n".join(lines)},
|
| 36 |
}, timeout=15)
|
| 37 |
if r.status_code == 200:
|
| 38 |
return True
|
trader/app.py
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|