From 2bc50b43201bdba2bdcf240da23af41e7cdd8d32 Mon Sep 17 00:00:00 2001 From: JJ Date: Mon, 10 Mar 2025 07:35:04 +0100 Subject: [PATCH] =?UTF-8?q?A=C3=B1adir=20que=20el=20script=20se=20detenga?= =?UTF-8?q?=20el=20martes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- python-utilities | 2 +- telegram-bot-guardias.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/python-utilities b/python-utilities index db4441c..e011ba6 160000 --- a/python-utilities +++ b/python-utilities @@ -1 +1 @@ -Subproject commit db4441c4d570704c9b5d7b1c397644f649180e4c +Subproject commit e011ba6a8e92bccfc8fe3920ad081ba79855ebf4 diff --git a/telegram-bot-guardias.py b/telegram-bot-guardias.py index 96e90ba..4670e8a 100644 --- a/telegram-bot-guardias.py +++ b/telegram-bot-guardias.py @@ -10,6 +10,7 @@ from telegram.ext import ( import json import datetime import pytz +import sys # Define la zona horaria TIMEZONE = pytz.timezone("Europe/Madrid") @@ -120,6 +121,12 @@ def next_monday(): # Función principal para iniciar el bot def main(): + # si ya es martes, paramos la ejecución del bot hasta el lunes que viene: + # Obtener la fecha actual + hoy = datetime.datetime.now(TIMEZONE) + if hoy == 1: + sys.exit() + # El token del bot application = ApplicationBuilder().token("1859561736:AAESVsdzTXmO8GjbifI4GihIQZuGqA3tNuk").build()