How to get original forwarded message id? #1905
-
Please answer these questions before submitting your issue. Thanks!
Hi guys! I want to give feedback to the user on the original message when it's approved or denied. I know how to edit an message, but I'm struggling to find its ids... Here's what I have now: @CanhoteiroMot_bot.callback_query_handler(func=lambda call: True)
def callback_query(call):
if call.data == "cb_confirm":
#Once the user confirms, the message is edited. *I WANT TO EDIT THIS MESSAGE AGAIN AFTER APPROVAL*
CanhoteiroMot_bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.message_id,
text="Delivery date: " + globalBS.DataEntrega.strftime('%d/%m/%Y (%a)') + "\nStatus: Pending approval ⏰.")
#Forwards msg to group
forwarded_msg = CanhoteiroMot_bot.forward_message(groupId, call.message.chat.id, globalBS.msg_photo_id)
#Reply to forwarded msg with inline keybord. *I WANT TO USE THIS TO EDIT THE MESSAGE I HAVE MENTIONED ABOVE*
CanhoteiroMot_bot.send_message(groupId,"Delivery date: " + globalBS.DeliveryDate.strftime('%d/%m/%Y (%a)'),reply_to_message_id=forwarded_msg.message_id,reply_markup=op_aprovar())
UpdateIndex(call.message.id) Now I want to get the callback query of the op_aprovar() keyboard, and edit the status on the fist message. Was myself clear? Here is what i've tried: elif call.data == "cb_approve":
#Edit message
CanhoteiroMot_bot.edit_message_text(chat_id=????, message_id=call.message.reply_to_message.message_id-1,
text=call.message.text + "\nApproved by " + call.from_user.first_name + " " + call.from_user.last_name + " at " + datetime.today().strftime('%d/%m/%Y')) Unfortunatelly call.message.reply_to_message.chat_id does not return anything. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Ok, I've managed to find the solution. CanhoteiroMot_bot.edit_message_text(chat_id=call.message.reply_to_message.forward_from.id, message_id=call.message.reply_to_message.message_id-1,
text=call.message.text + "\nStatus: Aprovado por " + call.from_user.first_name + " " + call.from_user.last_name + " em " + datetime.today().strftime('%d/%m/%Y')) The reason call.message.reply_to_message.forward_from.id wasn't returning my id, was due to my privacy settings regarding forwarded messages. This made my id to not show ant the message data. Thanks. |
Beta Was this translation helpful? Give feedback.
Ok, I've managed to find the solution.
The reason call.message.reply_to_message.forward_from.id wasn't returning my id, was due to my privacy settings regarding forwarded messages. This made my id to not show ant the message data.
Thanks.