Fixed old message udpate
This commit is contained in:
@@ -417,7 +417,10 @@ async def update_conjunta(update: Update, context: CallbackContext, conjunta_id)
|
|||||||
logging.error(f"Error editing message: {e}")
|
logging.error(f"Error editing message: {e}")
|
||||||
else:
|
else:
|
||||||
logging.info(f"Original message for {product_name} - {conjunta_id} is old, unpinning and sending new message")
|
logging.info(f"Original message for {product_name} - {conjunta_id} is old, unpinning and sending new message")
|
||||||
await context.bot.unpin_chat_message(chat_id=group_chat_id, message_id=message_id)
|
try:
|
||||||
|
await context.bot.unpin_chat_message(chat_id=group_chat_id, message_id=message_id)
|
||||||
|
except Exception as e:
|
||||||
|
logging.error(f"Error unpinning message: {e}")
|
||||||
sent_message = await context.bot.send_photo(chat_id=group_chat_id, photo=photo_id, caption=message, parse_mode=ParseMode.HTML)
|
sent_message = await context.bot.send_photo(chat_id=group_chat_id, photo=photo_id, caption=message, parse_mode=ParseMode.HTML)
|
||||||
await context.bot.pin_chat_message(chat_id=group_chat_id, message_id=sent_message.message_id, disable_notification=True)
|
await context.bot.pin_chat_message(chat_id=group_chat_id, message_id=sent_message.message_id, disable_notification=True)
|
||||||
cursor.execute("UPDATE conjuntas SET message_id = ?, message_date = ? WHERE id = ?", (sent_message.message_id, int(time.time()), conjunta_id))
|
cursor.execute("UPDATE conjuntas SET message_id = ?, message_date = ? WHERE id = ?", (sent_message.message_id, int(time.time()), conjunta_id))
|
||||||
@@ -460,8 +463,8 @@ async def handle_conjunta(update: Update, context: CallbackContext):
|
|||||||
await send_message_to_admins(update, context, f"@{user_name} se ha desapuntado de la conjunta {product_name} - {conjunta_id}")
|
await send_message_to_admins(update, context, f"@{user_name} se ha desapuntado de la conjunta {product_name} - {conjunta_id}")
|
||||||
try:
|
try:
|
||||||
await update_conjunta(update, context, conjunta_id)
|
await update_conjunta(update, context, conjunta_id)
|
||||||
except Exception:
|
except Exception as e:
|
||||||
pass
|
logging.error(f"Error updating conjunta: {e}")
|
||||||
else:
|
else:
|
||||||
await update.message.reply_text("La conjunta ya está cerrada y no puedes borrarte.")
|
await update.message.reply_text("La conjunta ya está cerrada y no puedes borrarte.")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user