Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import vk_api
- from vk_api.bot_longpoll import VkBotLongPoll, VkBotEventType
- vk_session = vk_api.VkApi(token='токен')
- vk = vk_session.get_api()
- longpoll = VkBotLongPoll(vk_session, vk.groups.getById()[0]['id'])
- for event in longpoll.listen():
- print(event.raw)
- if event.type == VkBotEventType.MESSAGE_NEW:
- if event.object.get('action'):
- vk.messages.send(message='Привет', peer_id=event.peer_id, random_id=0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement