vk_api icon indicating copy to clipboard operation
vk_api copied to clipboard

у меня вместо айди высвечивается None

Open vitalijtrojnin opened this issue 3 years ago • 3 comments

Новое сообщение: Для меня от: None Текст: None

vitalijtrojnin avatar Sep 24 '22 06:09 vitalijtrojnin

for event in longpoll.listen():

    if event.type == VkBotEventType.MESSAGE_NEW:
        print('Новое сообщение:')

        print('Для меня от: ', end='')

        print(event.obj.from_id)

        print('Текст:', event.obj.text)
        print()

    elif event.type == VkBotEventType.MESSAGE_REPLY:
        print('Новое сообщение:')

        print('От меня для: ', end='')

        print(event.obj.peer_id)

        print('Текст:', event.obj.text)
        print()

    elif event.type == VkBotEventType.MESSAGE_TYPING_STATE:
        print('Печатает ', end='')

        print(event.obj.from_id, end=' ')

        print('для ', end='')

        print(event.obj.to_id)
        print()

    elif event.type == VkBotEventType.GROUP_JOIN:
        print(event.obj.user_id, end=' ')

        print('Вступил в группу!')
        print()

    elif event.type == VkBotEventType.GROUP_LEAVE:
        print(event.obj.user_id, end=' ')

        print('Покинул группу!')
        print()

    else:
        print(event.type)
        print()

print('ok')

vitalijtrojnin avatar Sep 24 '22 06:09 vitalijtrojnin

The same thing: VkBotEventType.MESSAGE_NEW from_id:, None, peer_id: None

StasBobov avatar Oct 01 '22 14:10 StasBobov

print(event.object.message['from_id']) # Для VkBotEventType.MESSAGE_NEW print(event.object.user_id) # Для VkBotEventType.MESSAGE_EVENT

wait4meplz avatar Mar 21 '23 07:03 wait4meplz