06-sep: [feat] aviso de voz al terminar (Dalia/edge-tts) en opencode-tg + script aviso_voz

This commit is contained in:
juanjo
2026-09-06 20:17:32 +02:00
parent f6116d1af2
commit fd3f190534
2 changed files with 129 additions and 0 deletions

View File

@@ -160,6 +160,22 @@ def editar(chat_id, mid, texto, filas=None):
tg("editMessageText", data)
def _aviso_voz_fin(chat):
"""Aviso sonoro de fin de turno (nota de voz) si esta habilitado."""
if ENV.get("AVISO_VOZ", "0") != "1":
return
try:
subprocess.run(
[sys.executable, os.path.join(BASE, "aviso_voz.py"), str(chat)],
timeout=90, capture_output=True)
except Exception as e:
log(f"aviso_voz error: {e}")
def aviso_voz_fin(chat):
threading.Thread(target=_aviso_voz_fin, args=(chat,), daemon=True).start()
def typing(chat_id):
"""Manda sendChatAction 'typing' cada 4 s hasta que se detenga."""
stop = threading.Event()
@@ -460,6 +476,9 @@ def procesar_texto(chat, texto):
for ruta in adjuntos[:6]:
enviar_doc(chat, ruta)
# Aviso sonoro de fin (nota de voz en el movil), en segundo plano.
aviso_voz_fin(chat)
def cambiar_repo(chat, slug):
ruta = os.path.join(GH, slug)