Answer the question
In order to leave comments, you need to log in
How to reply to messages in a conversation and how to exclude users from a VK ID conversation?
Hello everyone, I'm new in the field of programming, so I decided to turn to Google first, which is why I didn't get an answer, but now I decided to turn to you.
I use my page, but the bot ignores messages both in the conversation and in the L / S. I tried several codes but it's 0, either an error, or there is no answer.
Actually, here is my shit code
import vk_api
from datetime import datetime
from vk_api.longpoll import VkLongPoll, VkEventType
token = "Токен" // токен пользователя
owner = "IdВладельцаКода"
vk_session = vk_api.VkApi(token=token)
session_api = vk_session.get_api()
longpoll = VkLongPoll(vk_session)
servertime = str(datetime.strftime(datetime.now(), "%H:%M"))
for event in longpoll.listen():
if event.type == VkEventType.MESSAGE_NEW:
response = event.text.lower()
if response == "Привет":
vk_session.method('messages.send', {'user_id': event.user_id, 'message': '1', 'random_id': 0})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question