import requests
import vk_api #Библиотека VK API
from vk_api.bot_longpoll import VkBotLongPoll, VkBotEventType #Библиотека VK LongPool
from vk_api.longpoll import VkLongPoll, VkEventType
from vk_api.utils import get_random_id
vk_session = vk_api.VkApi(token = 'a94555a01de3af80559b4184b10c33d5b8c88203afb449090b4bc0a06fa7485e3be0114453a3bf7681f1f') # Обработка access_token
longpoll = VkBotLongPoll(vk_session, '197122893') # Данные для работы в сообществе
vk = vk_session.get_api() # Работа с VK API
for event in longpoll.listen():
if event.type == VkBotEventType.MESSAGE_NEW:
message = event.object['message']
text = message['text']
peer_id = message['peer_id']
if text in {'Привет', 'привет'}:
vk.messages.send(peer_id=peer_id, message='Здравствуйте!', random_id=get_random_id())
elif event.type == VkBotEventType.PHOTO_NEW:
print('photo')