Answer the question
In order to leave comments, you need to log in
How to make a "who is online" command for a VK conversation for a bot on node js?
There is a VK bot, it is written in node js, I need to make a "who is online" command for a conversation
Answer the question
In order to leave comments, you need to log in
you get a list of those who are online now and display
const client = {
1: `мобильная версия`,
2: `приложение для iPhone`,
3: `приложение для iPad`,
4: `приложение для Android`,
5: `приложение для Windows Phone`,
6: `приложение для Windows 10`,
7: `полная версия сайта`
}
function getClient(user) {
return client[user.online_app]
}
vk.api.messages.getConversationMembers({
peer_id: msg.peerId,
fields: 'online, last_seen'
}).then(function(user){
let text = `Онлайн:\n`;
for( i in user.profiles){
if(user.profiles[i].online == 1){
text += `[id${user.profiles[i].id}|${user.profiles[i].first_name} ${user.profiles[i].last_name}][${getClient(user.profiles[i])}]\n`
}
}
return msg.send([text])
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question