Added error handling

This commit is contained in:
Joan Cano
2023-05-04 14:34:14 +02:00
parent dfbc6578b0
commit 137b0ce451

View File

@@ -61,7 +61,11 @@ async def sorteo(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
return return
logging.info("Empezando sorteo") logging.info("Empezando sorteo")
frase = update.message.text.split("/sorteo ")[1] try:
frase = update.message.text.split("/sorteo ")[1]
except:
await context.bot.send_message(chat_id=update.effective_chat.id, text="Error al arrancar el sorteo, asegúrate de poner la frase.")
return
global SORTEO_ACTIVO global SORTEO_ACTIVO
# Empezamos a leer mensajes # Empezamos a leer mensajes
SORTEO_ACTIVO = True SORTEO_ACTIVO = True