Здравствуйте, как сделать чтоб бот отвлекался только на мое сообщение?
import vk_api
from vk_api.longpoll import VkLongPoll, VkEventType
vk_session = vk_api.VkApi(token='token')
longpoll = VkLongPoll(vk_session)
vk = vk_session.get_api()
def send_msg(peer_id: int, message: str, attachment: str = ""):
return vk.messages.send(**locals(), random_id=0)
while True:
try:
for event in longpoll.listen():
if event.type == VkEventType.MESSAGE_NEW:
response = event.text.lower()
if response == "пинг":
time.sleep(3)
send_msg(event.peer_id, "PONG")
except Exception as e:
print(repr(e))