Added help command and feedback when closing conjunta

This commit is contained in:
Joan
2023-12-15 11:00:08 +01:00
parent f7fdd11cfe
commit 792ee49593

View File

@@ -562,6 +562,8 @@ async def close_conjunta(update: Update, context: CallbackContext):
# Desanclamos el mensaje # Desanclamos el mensaje
await context.bot.unpin_chat_message(group_chat_id, message_id) await context.bot.unpin_chat_message(group_chat_id, message_id)
await context.bot.send_message(chat_id=user_id, text=f"La conjunta para {product_name} ha sido cerrada correctamente.")
else: else:
await context.bot.send_message(chat_id=user_id, text="Solo el administrador puede cerrar la conjunta.") await context.bot.send_message(chat_id=user_id, text="Solo el administrador puede cerrar la conjunta.")
else: else:
@@ -659,6 +661,16 @@ async def send_message_to_admins(update: Update, context: CallbackContext, messa
except Exception as e: except Exception as e:
logging.error(f"Error sending message to {admin_id}: {e}") logging.error(f"Error sending message to {admin_id}: {e}")
async def help(update: Update, context: CallbackContext):
user_id = update.effective_user.id
# Verifica si el usuario es administrador
if user_id in admin_ids:
message = "Comandos disponibles:\n\n"
message += "/admin_summary - Muestra las conjuntas activas, permite modificarlas y cerrarlas\n"
message += "/start_conjunta - Inicia una nueva conjunta\n"
await update.message.reply_text(text=message, parse_mode=ParseMode.HTML)
def main()->None: def main()->None:
application = Application.builder().get_updates_http_version('1.1').http_version('1.1').token(bot_token).build() application = Application.builder().get_updates_http_version('1.1').http_version('1.1').token(bot_token).build()
@@ -684,6 +696,7 @@ def main()->None:
application.add_handler(CallbackQueryHandler(show_conjunta_details, pattern="info \d")) application.add_handler(CallbackQueryHandler(show_conjunta_details, pattern="info \d"))
application.add_handler(CallbackQueryHandler(close_conjunta, pattern="close \d")) application.add_handler(CallbackQueryHandler(close_conjunta, pattern="close \d"))
application.add_handler(MessageHandler(filters.REPLY, handle_conjunta)) application.add_handler(MessageHandler(filters.REPLY, handle_conjunta))
application.add_handler(CommandHandler('help', help))
application.run_polling() application.run_polling()