S
S
sergeyfilippov42019-07-20 10:51:02
Python
sergeyfilippov4, 2019-07-20 10:51:02

How to mention everyone?

There is this code:

if event.text.lower() == "хс":
                    users = vk.messages.getConversationMembers(peer_id=event.peer_id, fields='online')
                    ids = [item['member_id'] for item in users["items"]]
                    vk.messages.send(chat_id=event.chat_id,message=ids,random_id=0)

it produces a list like this:
516971682,474669925,337041458,549726754,552200476,451086050
how to mention everyone?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lightmanLP, 2019-07-20
@sergeyfilippov4

list - list of IDs
name - text that will be written in place of the name

mes = ''
for id in list:
 mes+= '[id'+str(id)+'|'+name+']'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question