F
F
Frayl2021-05-02 12:01:11
In contact with
Frayl, 2021-05-02 12:01:11

How to get payload?

For the VKontakte bot in Python, I did not find a way to find out the payload, and if there was, then they sent the buttons json with a scheme or the methods themselves were different.

In one of the videos on YouTube, I heard that payload can only be set in add_callback_button , but that's bad luck, in the ide tips it says that this argument can be set in other buttons as well. How to check if there is a payload, get it and install it.
The code:

session = vk_api.VkApi(token="токен")
longpoll = VkLongPoll(session)

for event in longpoll.listen():
    if event.type == VkEventType.MESSAGE_NEW:
        if event.to_me:
            user_id = event.user_id
            message = event.text

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Prizrak256, 2021-05-29
@Prizrak256

payload = event.payload

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question