06-sep: [feat] aviso de voz al terminar (Dalia/edge-tts) en opencode-tg + script aviso_voz
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user