W
W
WazzzUp10022019-10-03 12:02:39
Python
WazzzUp1002, 2019-10-03 12:02:39

How to get username via vkbot_longpoll?

Hello, I don’t understand how you can get the username of the person who entered the VK conversation through vkbot_longpoll. Maybe there are some methods? I tried using users.get
Here is the code I tried with: or What is my mistake? Bot community.
vk_api.users.get(user_id=1)
vk_api.users.get.fields['first_name']

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Lavrov, 2019-10-03
@WazzzUp1002

That's how I do

import vk_api 

vk_session = vk_api.VkApi('логин', 'пароль') 
vk_session.auth() 
 
vk = vk_session.get_api() 
id = "1"
user_get=vk.users.get(user_ids = (id))
user_get=user_get[0]
first_name=user_get['first_name']
last_name=user_get['last_name']
full_name=first_name+" "+last_name
print (full_name)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question