No username, no party

This commit is contained in:
Joan
2023-10-31 17:26:50 +01:00
parent 482222ec67
commit f617561c58

View File

@@ -367,6 +367,7 @@ async def handle_conjunta(update: Update, context: CallbackContext):
if limit is not None and quantity > limit_per_user or limit is not None and quantity > quantity_left(conjunta_id): if limit is not None and quantity > limit_per_user or limit is not None and quantity > quantity_left(conjunta_id):
await update.message.reply_text("La cantidad deseada excede el límite por usuario de la conjunta o no quedan suficientes.") await update.message.reply_text("La cantidad deseada excede el límite por usuario de la conjunta o no quedan suficientes.")
else: else:
if user_name:
cursor.execute("INSERT INTO conjunta_users (conjunta_id, user_id, user_name, quantity) VALUES (?, ?, ?, ?)", cursor.execute("INSERT INTO conjunta_users (conjunta_id, user_id, user_name, quantity) VALUES (?, ?, ?, ?)",
(conjunta_id, user_id, user_name, quantity)) (conjunta_id, user_id, user_name, quantity))
conn.commit() conn.commit()
@@ -382,6 +383,8 @@ async def handle_conjunta(update: Update, context: CallbackContext):
await update_conjunta(update, context, conjunta_id) await update_conjunta(update, context, conjunta_id)
except Exception: except Exception:
pass pass
else:
await update.message.reply_text("Por favor, tienes que ponerte un nick en Telegram para poder participar.")
except ValueError: except ValueError:
await update.message.reply_text("Por favor, introduce una cantidad válida.") await update.message.reply_text("Por favor, introduce una cantidad válida.")
else: else: