Answer the question
In order to leave comments, you need to log in
How to forward a message \ reply to a user in Vk via longpool?
I just started to master the VK longpool (I didn’t really find the answer in the documentation) and python. Code actually:
from vk_api.longpoll import VkLongPoll, VkEventType
import vk_api, random
from datetime import datetime
import random
login, password = "Логин", "Пароль"
vk_session = vk_api.VkApi(login=login, password=password, app_id=2685278)
vk_session.auth(token_only=True)
session_api = vk_session.get_api()
longpoll = VkLongPoll(vk_session)
def send_message(peer_id, message=None, attachment=None, keyboard=None, payload=None):
session_api.messages.send(peer_id=peer_id, message=message, random_id=random.randint(-2147483648, +2147483648),
attachment=attachment, keyboard=keyboard, payload=payload)
for event in longpoll.listen():
if event.type == VkEventType.MESSAGE_NEW:
print('Текст сообщения: ' + str(event.text))
response = event.text.lower()
if response =='баф899':
send_message(peer_id=event.peer_id,message='Благословение атаки')
Answer the question
In order to leave comments, you need to log in
https://vk.com/dev/messages.send
reply_to - ID of the message to which you want to reply.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question