Enviar a quien responda que esta de guardia un enlace de invitación
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
|||||||
{"ultimo_guardia": 884077168}
|
{"ultimo_guardia": 569107396}
|
||||||
@@ -41,6 +41,9 @@ USUARIOS_EXCLUIDOS = [132308323, 127382235]
|
|||||||
# ID del grupo de alertas
|
# ID del grupo de alertas
|
||||||
GRUPO_ALERTAS_ID = -1002252938840
|
GRUPO_ALERTAS_ID = -1002252938840
|
||||||
|
|
||||||
|
# El enlace de invitación al grupo:
|
||||||
|
ENLACE_INVITACION = "https://t.me/+mejk7iBHZQA3NDY0"
|
||||||
|
|
||||||
# Función para cargar los datos de guardia desde el archivo
|
# Función para cargar los datos de guardia desde el archivo
|
||||||
def cargar_guardia():
|
def cargar_guardia():
|
||||||
try:
|
try:
|
||||||
@@ -81,7 +84,11 @@ async def manejar_respuesta(update: Update, context: CallbackContext):
|
|||||||
# Invitar al nuevo guardia al grupo de alertas
|
# Invitar al nuevo guardia al grupo de alertas
|
||||||
try:
|
try:
|
||||||
await context.bot.unban_chat_member(chat_id=GRUPO_ALERTAS_ID, user_id=usuario)
|
await context.bot.unban_chat_member(chat_id=GRUPO_ALERTAS_ID, user_id=usuario)
|
||||||
await context.bot.send_message(chat_id=usuario, text="Te has unido al grupo de alertas de guardias.")
|
mensaje = (
|
||||||
|
"¡Gracias por confirmar que estás de guardia esta semana!\n\n"
|
||||||
|
f"Únete al grupo de alertas usando este enlace: {ENLACE_INVITACION}"
|
||||||
|
)
|
||||||
|
await context.bot.send_message(chat_id=usuario, text=mensaje)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error al invitar al usuario {usuario}: {e}")
|
logger.error(f"Error al invitar al usuario {usuario}: {e}")
|
||||||
|
|
||||||
@@ -107,7 +114,7 @@ def main():
|
|||||||
# el lunes es days=(7 - ahora.weekday())
|
# el lunes es days=(7 - ahora.weekday())
|
||||||
# el viernes es days=(4 - ahora.weekday())
|
# el viernes es days=(4 - ahora.weekday())
|
||||||
proximo_lunes = ahora + datetime.timedelta(days=(4 - ahora.weekday()))
|
proximo_lunes = ahora + datetime.timedelta(days=(4 - ahora.weekday()))
|
||||||
proximo_lunes = proximo_lunes.replace(hour=9, minute=30, second=0, microsecond=0)
|
proximo_lunes = proximo_lunes.replace(hour=11, minute=25, second=0, microsecond=0)
|
||||||
|
|
||||||
application.job_queue.run_repeating(enviar_mensaje_guardia, interval=datetime.timedelta(weeks=1), first=proximo_lunes)
|
application.job_queue.run_repeating(enviar_mensaje_guardia, interval=datetime.timedelta(weeks=1), first=proximo_lunes)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user