Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
vitalijtrojnin opened this issue Sep 24, 2022 · 3 comments
Open

Comments

@vitalijtrojnin
Copy link

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

@vitalijtrojnin
Copy link
Author

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')

@StasBobov
Copy link

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

@wait4meplz
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants