P
P
pivazik2020-06-03 19:50:58
Python
pivazik, 2020-06-03 19:50:58

How to get the ID of the user invited to the conversation?

We need to get the user ID from the "chat_invite_user" event.
The code that is now there, but it does not give the ID of the invited user, but the ID of the one who invited him for reasons I understand:

if 'action' in event.raw['object']:
        if 'chat_invite_user' in event.raw['object']['action']['type']:
          invite_id = event.obj["from_id"]
          user = vk.method("users.get", {"user_ids": invite_id})
          first_name = user[0]['first_name']

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WolfInChains, 2020-06-03
@pivazik

if 'action' in event.raw['object']:
    if 'chat_invite_user' or 'chat_invite_user_by_link' in event.raw['object']['action']['type']:
        user_id = event.raw['object']['action']['member_id']

Name I think and pull out yourself

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question