@@ -29,6 +29,55 @@ async def joder(update: Update, context: ContextTypes.DEFAULT_TYPE):
2929 logger .error (f"Failed to send joder message: { e } " )
3030 await update .message .reply_text (f"Error al enviar el mensaje: { e } " )
3131
32+ async def movergrupo (update : Update , context : ContextTypes .DEFAULT_TYPE ):
33+ user_id = update .effective_user .id
34+ if user_id not in admin_ids and str (user_id ) not in admin_ids :
35+ logger .warning (f"Unauthorized user { user_id } tried to access /movergrupo" )
36+ return
37+
38+ if not context .args :
39+ await update .message .reply_text ("Uso: /movergrupo <nombre exacto del grupo>" )
40+ return
41+
42+ name = " " .join (context .args )
43+ with get_session () as session :
44+ from models import Listable
45+ groups = session .query (Listable ).filter (Listable .name .ilike (f"%{ name } %" )).all ()
46+
47+ if not groups :
48+ await update .message .reply_text ("No se encontró ningún grupo con ese nombre." )
49+ return
50+
51+ if len (groups ) > 1 :
52+ names = "\n " .join ([f"- { g .name } ({ g .type } )" for g in groups ])
53+ await update .message .reply_text (f"Se encontraron múltiples grupos:\n { names } \n \n Por favor, sé más específico." )
54+ return
55+
56+ group = groups [0 ]
57+
58+ keyboard = [
59+ [
60+ InlineKeyboardButton ("Grupo (Oblig.)" , callback_data = f"MoverGrupo|{ group .id } |Grupo" ),
61+ InlineKeyboardButton ("GrupoOptativa" , callback_data = f"MoverGrupo|{ group .id } |GrupoOptativa" ),
62+ InlineKeyboardButton ("ECI" , callback_data = f"MoverGrupo|{ group .id } |ECI" )
63+ ],
64+ [
65+ InlineKeyboardButton ("Otro" , callback_data = f"MoverGrupo|{ group .id } |Otro" ),
66+ InlineKeyboardButton ("GrupoOtros" , callback_data = f"MoverGrupo|{ group .id } |GrupoOtros" ),
67+ InlineKeyboardButton ("Obligatoria (viejo)" , callback_data = f"MoverGrupo|{ group .id } |Obligatoria" ),
68+ ],
69+ [
70+ InlineKeyboardButton ("Optativa (viejo)" , callback_data = f"MoverGrupo|{ group .id } |Optativa" ),
71+ InlineKeyboardButton ("Cancelar" , callback_data = f"MoverGrupo|{ group .id } |Cancelar" )
72+ ]
73+ ]
74+ reply_markup = InlineKeyboardMarkup (keyboard )
75+ await update .message .reply_text (
76+ f"Seleccioná la nueva categoría para el grupo:\n \n *Nombre:* { group .name } \n *Categoría Actual:* { group .type } " ,
77+ reply_markup = reply_markup ,
78+ parse_mode = ParseMode .MARKDOWN
79+ )
80+
3281async def checodepers (update : Update , context : ContextTypes .DEFAULT_TYPE ):
3382 if not context .args :
3483 ejemplo = """ Ejemplo de uso:
0 commit comments