M
M
MarkSmersh2021-04-15 16:46:46
Python
MarkSmersh, 2021-04-15 16:46:46

How to send a friend request to a group member via vk_api?

Do I need to query the members via the groups.getMembers method, or what? Preferably with sample code

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MarkSmersh, 2021-05-04
@MarkSmersh

In general, everything was decided by itself

import vk_api

GROUPS_IDS = ('айди групп')

user_ids = api.method('groups.getMembers', {'group_id':random.choice(GROUPS_IDS), 'sort':('id_desc'), 'count':1000})['items']
        user = random.choice(user_ids)
        api.method('friends.add', {'user_id':user})

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question