Fix broken send_telegram_direct: restore missing data= line
This commit is contained in:
@@ -72,16 +72,14 @@ _sent_hashes: set = set()
|
||||
|
||||
|
||||
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]
|
||||
if h in _sent_hashes:
|
||||
print(f'[agent-runner] dedup: skipping duplicate message (hash={h})')
|
||||
print(f'[agent-runner] dedup stack: {tb.format_stack()[-3].strip()}')
|
||||
return
|
||||
_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'
|
||||
data = json.dumps({'chat_id': chat_id, 'text': text}).encode()
|
||||
req = urllib.request.Request(url, data=data, headers={'Content-Type': 'application/json'})
|
||||
urllib.request.urlopen(req, timeout=10)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user