V
V
Victor Bessmertny2020-07-13 00:55:37
Python
Victor Bessmertny, 2020-07-13 00:55:37

How to create a VKontakte bot that will forward messages?

Hello. I would like to create a bot for a page or group that forwards messages from one conversation to another if they start with a certain word. Tell me how it can be done, where to start?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alekssamos, 2020-07-13
@alekssamos

In the previous the answer specifies the library for php, and the tag python. Therefore
https://github.com/python273/vk_api/

# ...
for event in longpoll.listen():
    if event.type == VkBotEventType.MESSAGE_NEW:
        m = event.object.message
        if m["text"].startswith("начало слова"):
            vk.messages.send(
                    random_id=get_random_id(),
                    peer_id=200000000001,
                    forward_messages = [m["id"]])

Approximately so, did not check, can not work. But the principle is clear.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question