Answer the question
In order to leave comments, you need to log in
How to get a value into a variable?
Hello, I would like to get the ID of the person of the message that was replied to,
if event.type == VkBotEventType.MESSAGE_NEW:
peer_id = event.object.peer_id
message = event.object.text
reply_message = event.object.reply_message
print(reply_message)
if event.type == VkBotEventType.MESSAGE_NEW:
peer_id = event.object.peer_id
message = event.object.text
reply_message = event.object.reply_message.from_id
print(reply_message)
gives an error that the "from_id" object does not exist...Answer the question
In order to leave comments, you need to log in
I dare to suggest that you need to contact reply_message = event.object.reply_message.get("from_id")
In the error it says that event.object.reply_message is a dictionary (which is also visible in the output on the first screenshot), which means you need just use the key
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question