F
F
fleksss_pod_papicha2020-07-27 16:46:20
Python
fleksss_pod_papicha, 2020-07-27 16:46:20

How to pass a list of user ids to user_ids?

I am writing a bot for VK and to send the same message to several users at once in the vk_api library, there is

vk_session.method('messages.send', {передаём параметры в том числе и user_ids})


The documentation says that you need to pass a comma-separated list of ids, I tried to pass a Python list, a tuple, and a set to the user_ids parameter, but it doesn’t work at all, tell me how and what to pass to this parameter correctly so that it works

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Megum1n, 2020-07-27
@Megum1n

You need to pass to the method all the parameters for sending messages, but instead of user_id , specify list user_ids .

vk_session.method('messages.send', {
    user_ids: [1, 123, 12345],
    message='test'
})

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question