Answer the question
In order to leave comments, you need to log in
Why does event.obj.user_id return None?
This code is not working, because event.object.user_id returns None.
for event in longpoll.listen():
if event.type == VkBotEventType.MESSAGE_NEW:
if event.from_chat:
if event.object.text == '!tap':
print(event.object.user_id)
if admin(event.user_id) == True:
kick_id = vk.messages.getById(message_ids=event.message_id)['items'][0]['reply_message']['from_id']
vk.messages.send(chat_id=event.chat_id, message='[id%s|пока]'%kick_id, random_id=0)
vk.messages.removeChatUser(user_id=kick_id,chat_id=event.chat_id)
Answer the question
In order to leave comments, you need to log in
message object has no user_id field, since version 5.80 you need from_id
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question