Added start message and more
This commit is contained in:
@@ -314,6 +314,7 @@ async def handle_conjunta(update: Update, context: CallbackContext):
|
||||
worksheet.delete_rows(found_cell.row)
|
||||
|
||||
await update.message.reply_text("¡Desapuntado de la conjunta!")
|
||||
await send_message_to_admins(update, context, f"@{user_name} se ha desapuntado de la conjunta {product_name} - {conjunta_id}")
|
||||
try:
|
||||
await update_conjunta(update, context, conjunta_id)
|
||||
except Exception:
|
||||
@@ -357,6 +358,7 @@ async def handle_conjunta(update: Update, context: CallbackContext):
|
||||
worksheet.append_row([user_name, quantity, "SÍ" if socio else "NO"])
|
||||
|
||||
await update.message.reply_text(f"Te has unido a la conjunta para '{product_name}' con {quantity} unidades.")
|
||||
await send_message_to_admins(update, context, f"@{user_name} se ha apunta a la conjunta {product_name} - {conjunta_id} con {quantity} unidades")
|
||||
try:
|
||||
await update_conjunta(update, context, conjunta_id)
|
||||
except Exception:
|
||||
@@ -492,6 +494,14 @@ async def show_conjunta_details(update: Update, context: CallbackContext):
|
||||
|
||||
await context.bot.send_photo(chat_id=update.effective_chat.id, photo=photo_id, caption=selected_conjunta_details, parse_mode=ParseMode.HTML)
|
||||
|
||||
# Función para enviar un mensaje a todos los administradores
|
||||
async def send_message_to_admins(update: Update, context: CallbackContext, message):
|
||||
for admin_id in admin_ids:
|
||||
try:
|
||||
context.bot.send_message(chat_id=admin_id, text=message, parse_mode=ParseMode.HTML)
|
||||
except Exception as e:
|
||||
logging.error(f"Error sending message: {e}")
|
||||
|
||||
def main()->None:
|
||||
application = Application.builder().get_updates_http_version('1.1').http_version('1.1').token(bot_token).build()
|
||||
|
||||
@@ -517,6 +527,13 @@ def main()->None:
|
||||
application.add_handler(CallbackQueryHandler(close_conjunta, pattern="close \d"))
|
||||
application.add_handler(MessageHandler(filters.REPLY, handle_conjunta))
|
||||
|
||||
# Avisamos de que el bot está en funcionamiento
|
||||
for admin_id in admin_ids:
|
||||
try:
|
||||
application.bot.send_message(chat_id=admin_id, text="El bot acaba de arrancar y está en funcionamiento.")
|
||||
except Exception as e:
|
||||
logging.error(f"Error sending message: {e}")
|
||||
|
||||
application.run_polling()
|
||||
|
||||
conn.close()
|
||||
|
||||
Reference in New Issue
Block a user