S
S
Stuksus2019-09-16 21:43:46
Python
Stuksus, 2019-09-16 21:43:46

Why does an error occur while working with the VK API when using the reply_to argument in the messages.send method?

It is necessary to reply to the previous message from the conversation on behalf of the bot, when using the reply_to argument, an error occurs:
vk_api.exceptions.ApiError: [100] One of the parameters specified was missing or invalid: cannot reply this message

but the message does not forward (does not attach)
I get the message Id from the "conversation_message_id" field,
here is the code of the message sending method itself:

def write_msg(session,user_id, message,replyId): #Write message to user
    rand=random.randint(-9223372036854775807,9223372036854775807)
    session.method('messages.send', {'peer_id': user_id,'random_id':rand ,'message': str(message),"reply_to":int(replyId)})

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stockholm Syndrome, 2019-09-16
@StockholmSyndrome

When using forward_messages, the bot does not give errors, but the message does not forward (does not attach)
I get the message Id from the "conversation_message_id" field

a message can be forwarded or answered, while these are different things
forward_messages - for forwarding, reply_to - for answering,
but the bot cannot do either, because communities in conversations do not save the history of correspondence, and all messages have id = 0
conversation_message_id is the id of the message within the conversation, for forwarding you need exactly the global id from the bot itself

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question