A
A
Artur2020-05-27 18:24:11
Python
Artur, 2020-05-27 18:24:11

How to get username and send his name with message?

Need to get a username and attach it to a post?

vk = vk_session.get_api() 
    id = "тут айди пользователя",
    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)

    

   elif word == "hi":
        if event.from_chat:
               vk.messsage.send(
                	chat_id=event.chat_id,
                	random_id=get_random_id(),
                	message="hi " + first_name
                	)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question