V
V
Vlad Tanashchuk2020-06-18 08:30:04
Python
Vlad Tanashchuk, 2020-06-18 08:30:04

How can I get the date a user was added to a conversation by their ID?

Now I use the messages.getConversationMembers method, because I no longer found more than one method that allows you to view the date the participant was added, I drew a little code and as a result something like this came out:

data = session_api.messages.getConversationMembers(peer_id=event.peer_id)
data_items = data["items"]
  for item in data_items:
      join_date = int(item["join_date"])

This script, of course, gives out the date, but the wrong user, and then the question arises - "How can I get the "join_date" field by user ID?"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2020-06-18
@Xaeruz

def get_join_date(user_id, conversation_id):
    data = session_api.messages.getConversationMembers(peer_id=conversation_id)
    data_items = data["items"]
    for item in data_items:
        if item['member_id'] == user_id:
            return int(item["join_date"])

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question