Fix broken send_telegram_direct: restore missing data= line

This commit is contained in:
daniel
2026-05-07 18:47:16 -05:00
parent e35599b522
commit d44fd788f9

View File

@@ -72,16 +72,14 @@ _sent_hashes: set = set()
def send_telegram_direct(chat_id: str, token: str, text: str) -> None: def send_telegram_direct(chat_id: str, token: str, text: str) -> None:
import hashlib, traceback as tb import hashlib
h = hashlib.md5(f'{chat_id}:{text}'.encode()).hexdigest()[:12] h = hashlib.md5(f'{chat_id}:{text}'.encode()).hexdigest()[:12]
if h in _sent_hashes: if h in _sent_hashes:
print(f'[agent-runner] dedup: skipping duplicate message (hash={h})') print(f'[agent-runner] dedup: skipping duplicate message (hash={h})')
print(f'[agent-runner] dedup stack: {tb.format_stack()[-3].strip()}')
return return
_sent_hashes.add(h) _sent_hashes.add(h)
print(f'[agent-runner] SEND hash={h} text={repr(text[:40])}')
print(f'[agent-runner] SEND caller: {tb.format_stack()[-2].strip()}')
url = f'https://api.telegram.org/bot{token}/sendMessage' url = f'https://api.telegram.org/bot{token}/sendMessage'
data = json.dumps({'chat_id': chat_id, 'text': text}).encode()
req = urllib.request.Request(url, data=data, headers={'Content-Type': 'application/json'}) req = urllib.request.Request(url, data=data, headers={'Content-Type': 'application/json'})
urllib.request.urlopen(req, timeout=10) urllib.request.urlopen(req, timeout=10)