N
N
nintendolyub2020-05-06 04:02:15
Python
nintendolyub, 2020-05-06 04:02:15

How to make a reply bot?

Look, I have a script that will respond to each message randomly from the proposed ones, so what's the problem? please help, if the bot should respond on behalf of the page (the token is entered)

from vk_api.longpoll import VkLongPoll, VkBotEventType
import vk_api

vk = vk_api.VkApi(token="токен")

vk._auth_token()

vk.get_api()

longpoll = VkBotLongPoll(vk, id)

while True:
    ch = r-100000000
    for event in longpoll.listen():
        if event.type == VkEventType.MESSAGE_NEW:
            vk.method('messages.send',{'chat_id':ch,'random_id':0,'keyboard':keyboard,'message':m2})
m2 = 'сообщение'
m = 'тут тоже'
m3 = 'сообщение'

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