A
A
Artem Dostalev2020-12-30 19:47:47
Python
Artem Dostalev, 2020-12-30 19:47:47

How to force a bot to resend a photo from a conversation?

I tried to write a bot for the VK group. Was able to get it to resend the text, but the photo couldn't. Here is the code:
import vk_api
from vk_api.longpoll import VkLongPoll, VkEventType
from toks import main_token

vk_session = vk_api.VkApi(token = 'here is my key')
vk = vk_session.get_api()
longpoll = VkLongPoll(vk_session)

def sender(id , text):
vk.messages.send(user_id = id, message = text, random_id = 0)

for event in longpoll.listen():
if event.type == VkEventType.MESSAGE_NEW:
if event.to_me:
msg = event. text
id = event.user_id
sender(id, msg)

Help with advice!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question