N
N
nnikolyaa2020-11-28 17:52:55
Python
nnikolyaa, 2020-11-28 17:52:55

Not a complete answer from VK?

When checking the online bot on VK, a message.getConversationMembers request is sent, from which we get "online" in profiles. But the whole joke is that everyone has 0, except for me. I haven't found any dependency yet.
The code:

onp=0
ont=0
of=0
bot=0
ontwo=0
response = vk.messages.getConversationMembers(peer_id=event.object.peer_id, fields= 'online')
members=response['count']
onl = 'Кто туточки:З? Ага, вот кто:\n\n'
admin_bot_online=open('admin.txt','r')
who_adm_online=admin_bot_online.read()
admin_bot_online.close()
print(str(response))
for per_o in response['profiles']:
    print(str(per_o.get('id'))+" "+str(per_o.get('online'))+" "+str(per_o.get('online_mobile')))
    if str(per_o.get('online'))=='1':
        id_whoon=per_o.get('id')
        with sq.connect('users.db', timeout=1) as con:
            cur = con.cursor()
            cur.execute(f"SELECT nick FROM users WHERE user_id='{id_whoon}' AND chat_id='{peid}'")
            nickf=str(cur.fetchone())
            nick=nickf[2:-3]
        if str(nick) == '':
            nick=str(per_o.get('first_name'))+' '+str(per_o.get('last_name'))
        where_adm_online=who_adm_online.count(str(id_whoon))
        if str(where_adm_online)!='0':
            status_online=''
        else:
            status_online=''
        if str(per_o.get('online_mobile')) == "1" or str(per_o.get('is_mobile')) == '1':
            onl += (''+str(nick)+str(status_online)+'\n')
            ont += 1
        else:
            onl += (''+str(nick)+str(status_online)+'\n')
            onp += 1
    else:
        of += 1
ontwo = onp + ont
bot = members - (of + ontwo)
vk.messages.send(
    peer_id=event.object.peer_id,
    random_id=get_random_id(),
    message=(str(onl)+'\n\nВ общем: '+str(members)+'\nНа телефонах: '+str(ont)+'\nНа ПК: '+str(onp)+'\nВместе: '+str(ontwo)+'\nБотов: '+str(bot)+'\nОфлайн: '+str(of))
)

response:
{'items': [{'member_id': 375491139, 'invited_by': 375491139, 'join_date': 1598120725, 'is_admin': True, 'is_owner': True}, {'member_id':
 453233524, 'can_kick': True, 'invited_by': 375491139, 'join_date': 1598120725}, {'member_id': -194647816, 'invited_by': 375491139, 'join_date': 1598125357, 'is_admin': True}, {'member_id': 366896938, 'can_kick': True, 'invited_by': 375491139, 'join_date': 1598204456}, {'member_id': 594220612, 'can_kick': True, 'invited_by': 375491139, 'join_date': 1598204887}, {'member_id': -196288744, 'invited_by': 375491139, 'join_date': 1598213494, 'is_admin': True}], 'count': 6, 'profiles': [{'first_name': 'Александр', 'id': 366896938, 'last_name': 'Хмелевский', 'can_access_closed': True, 'is_closed': False, 'online': 0}, {'first_name': 'Иван', 'id': 375491139, 'last_name': 'Николяен
ко', 'can_access_closed': True, 'is_closed': False, 'online': 1}, {'first_name': 'Анастасия', 'id': 453233524, 'last_name': 'Камышова', 
'can_access_closed': True, 'is_closed': False, 'online': 0}, {'first_name': 'Nikos', 'id': 594220612, 'last_name': 'Zeld', 'can_access_c
losed': True, 'is_closed': False, 'online': 0}], 'groups': [{'id': 194647816, 'name': 'AMV bot', 'screen_name': 'amvbot', 'is_closed': 0
, 'type': 'group', 'photo_50': 'https://sun6-22.userapi.com/impg/2ymGvUbaE0I2FCFU8y7VZGaT-fNQ93vC3gHbfQ/ptQDVeo--tQ.jpg?size=50x0&qualit
y=88&crop=4,4,809,809&sign=cc9a40873798c1af77a42089f2f61a10&c_uniq_tag=4PJ9MXLcSSPJMpMgfM9T6GjeyBoQcAj1o3dSFF5IsSY&ava=1', 'photo_100': 
'https://sun6-22.userapi.com/impg/2ymGvUbaE0I2FCFU8y7VZGaT-fNQ93vC3gHbfQ/ptQDVeo--tQ.jpg?size=100x0&quality=88&crop=4,4,809,809&sign=6d7
d44a16d987441c0600561870cde6a&c_uniq_tag=1wEfgpvoeyMPKV0RPRd91m5b-pa3oM_H6SGINfzCrbM&ava=1', 'photo_200': 'https://sun6-22.userapi.com/i
mpg/2ymGvUbaE0I2FCFU8y7VZGaT-fNQ93vC3gHbfQ/ptQDVeo--tQ.jpg?size=200x0&quality=88&crop=4,4,809,809&sign=4f1ed62f6f1622e628f26450ca7f0a66&
c_uniq_tag=G_NSsC6XlIA0z63nDfKmUMvFzGDWDp_9o9HJQFvCdv8&ava=1'}, {'id': 196288744, 'name': 'Братик', 'screen_name': 'bratikbot', 'is_clos
ed': 0, 'type': 'page', 'photo_50': 'https://sun6-20.userapi.com/impg/c855624/v855624885/24d350/X4j5SAwD5dU.jpg?size=50x0&quality=88&cro
p=475,58,320,320&sign=3cf0d7eb9a6e7254857b9a5bd800fb43&c_uniq_tag=dQQ76wKFFdv1oAk-csmddDr_3p13g4EGJXxL2YMzcyY&ava=1', 'photo_100': 'http
s://sun6-20.userapi.com/impg/c855624/v855624885/24d350/X4j5SAwD5dU.jpg?size=100x0&quality=88&crop=475,58,320,320&sign=a5bccfb208c1b0aab5
8c87a076e83ee1&c_uniq_tag=bKGaYOPKdmepax9zXMKiO1k6PYOzTBWRuEaPKWd2l3o&ava=1', 'photo_200': 'https://sun6-20.userapi.com/impg/c855624/v85
5624885/24d350/X4j5SAwD5dU.jpg?size=200x0&quality=88&crop=475,58,320,320&sign=1c86015b9d7eab2dce190e4f546b52e9&c_uniq_tag=st_5C68GU-xaRw
yxbKHn5IHhoHxStcFNRMqnMEaWVZY&ava=1'}]}

Conclusion:

Who's here: Z? Yeah, that's who:

Ivan Nikolaenko Total

: 6
On phones: 0
On PC: 1
Together: 1
Bots: 2
Offline: 3

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2020-11-28
@SoreMix

So people are offline, or the status is hidden, what else to add.
4 people in profiles:
1. 366896938 - hidden online 2. 375491139
- hidden online 3. 453233524
- dead
4. 594220612 - hidden
online

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question