R
R
RINAMI2021-07-16 19:33:03
Python
RINAMI, 2021-07-16 19:33:03

Why is the bot not responding to the "replay" message?

using this function, the bot should respond with a "replay" to the user's messages:

def chatsenderreply(id, text):
    vk.method("messages.send", {"chat_id": id, "message": text, "reply_to": event.obj['message']['from_id'], "random_id": 0})
    pass


But it gives an error saying that there is an internal server error, but in fact, if you change it like this:
def chatsenderreply(id, text):
    vk.method("messages.send", {"chat_id": id, "message": text, "reply_to": event.obj.message['id'], "random_id": 0})
    pass


Then the bot answers, but we do not "replay"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
slikkness, 2021-07-17
@RINAMI

Import the json library and specify this as an additional parameter in messages.send instead of reply_to:

forward = json.dumps({'peer_id': 2000000000 + chatid,
                      'conversation_message_ids': [event.object.message['conversation_message_id']],
                      'is_reply': True})

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question