Skip to content

Commit 248c8fd

Browse files
committed
Fix: resolve logging shadow and enhance river/concert cron
- Renamed utils/logging.py to utils/logger.py to prevent shadowing the standard library logging module, which was causing the cron to fail when fetching River matches. - Updated River and concert crons to ignore events falling on weekends (Saturdays and Sundays). - Added the weekday name to the notification message for events falling on weekdays.
1 parent cafb87f commit 248c8fd

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

handlers/crons.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,24 +54,40 @@ async def felizdia(context: ContextTypes.DEFAULT_TYPE):
5454
async def actualizarPartidos(context: ContextTypes.DEFAULT_TYPE):
5555
hoy = datetime.datetime.now(bsasTz)
5656
mañana = hoy + datetime.timedelta(days=1)
57+
58+
if mañana.weekday() >= 5:
59+
return
60+
5761
try:
5862
local, partido = river.es_local(mañana)
5963
if not local:
6064
return
65+
66+
dias_semana = ["lunes", "martes", "miércoles", "jueves", "viernes", "sábado", "domingo"]
67+
nombre_dia = dias_semana[mañana.weekday()]
68+
6169
horario = "hora a confirmar" if partido.hora is None else partido.hora.strftime("a las %H:%M")
62-
msg = f"Mañana juega River, {horario}\n(contra {partido.equipo_visitante}, {partido.copa})"
70+
msg = f"Mañana {nombre_dia} juega River, {horario}\n(contra {partido.equipo_visitante}, {partido.copa})"
6371
await context.bot.send_message(chat_id=NOTICIAS_CHATID, text=msg)
6472
except Exception as e:
6573
logger.error(f"Error checking River matches: {e}")
6674

6775
async def actualizarConciertos(context: ContextTypes.DEFAULT_TYPE):
6876
hoy = datetime.datetime.now(bsasTz)
6977
mañana = hoy + datetime.timedelta(days=1)
78+
79+
if mañana.weekday() >= 5:
80+
return
81+
7082
try:
7183
hay, concierto = conciertos.hay_concierto(mañana)
7284
if not hay:
7385
return
74-
msg = f"Mañana hay un concierto en River\n{concierto.titulo}"
86+
87+
dias_semana = ["lunes", "martes", "miércoles", "jueves", "viernes", "sábado", "domingo"]
88+
nombre_dia = dias_semana[mañana.weekday()]
89+
90+
msg = f"Mañana {nombre_dia} hay un concierto en River\n{concierto.titulo}"
7591
await context.bot.send_message(chat_id=NOTICIAS_CHATID, text=msg)
7692
except Exception as e:
7793
logger.error(f"Error checking concerts: {e}")
File renamed without changes.

0 commit comments

Comments
 (0)