06-sep: [menu] pendiente con slash vuelve al menu + categoria segun comando
This commit is contained in:
@@ -475,6 +475,27 @@ def volver_al_menu(chat_id, categoria=None):
|
||||
_reenviar_menu(chat_id, categoria)
|
||||
|
||||
|
||||
def categoria_de(comando):
|
||||
"""Categoria del menu a la que pertenece un comando de texto."""
|
||||
mapa = {
|
||||
"busca": "videoclub", "pelicula": "videoclub",
|
||||
"serie": "videoclub", "novedades": "videoclub",
|
||||
"torrents": "videoclub", "bajar": "videoclub",
|
||||
"genero": "videoclub",
|
||||
"tv": "tv", "alarma": "tv", "youtube": "tv",
|
||||
"descargar": "nas", "descargas": "nas", "borrar": "nas",
|
||||
"parental": "parental",
|
||||
"termo": "termo", "pantalla": "pantalla",
|
||||
"aspiradora": "aspi", "meross": "mesillas",
|
||||
"router": "router", "aimesh": "sistema", "qos": "sistema",
|
||||
"limite": "sistema", "seguridad": "sistema",
|
||||
"estado": "sistema", "temperatura": "sistema",
|
||||
"panorama": "sistema", "limpieza": "sistema",
|
||||
"limpiar": "sistema",
|
||||
}
|
||||
return mapa.get((comando or "").lower().strip())
|
||||
|
||||
|
||||
def _teclado_categoria(chat_id, categoria):
|
||||
teclados = {
|
||||
"videoclub": lambda: teclado_videoclub(chat_id),
|
||||
|
||||
@@ -403,6 +403,14 @@ def procesar(texto, chat_id):
|
||||
menu_idd.cancelar_pendiente(chat_id)
|
||||
if t in ("cancelar", "cancel", "salir"):
|
||||
return
|
||||
# Venia del menu: procesar y devolver al menu.
|
||||
procesar(texto, chat_id)
|
||||
try:
|
||||
menu_idd.volver_al_menu(chat_id,
|
||||
menu_idd.categoria_de(comando))
|
||||
except Exception:
|
||||
pass
|
||||
return
|
||||
elif menu_idd.pendiente_activo(chat_id):
|
||||
if menu_idd.resolver_pausa_minutos(chat_id, texto):
|
||||
return
|
||||
@@ -414,7 +422,9 @@ def procesar(texto, chat_id):
|
||||
if cmd:
|
||||
procesar(cmd, chat_id)
|
||||
try:
|
||||
menu_idd.volver_al_menu(chat_id)
|
||||
menu_idd.volver_al_menu(
|
||||
chat_id,
|
||||
menu_idd.categoria_de(cmd.split(None, 1)[0]))
|
||||
except Exception:
|
||||
pass
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user