N
N
nintendolyub2020-08-26 17:13:08
Python
nintendolyub, 2020-08-26 17:13:08

What is the problem with the vk_api bot?

The bot does not respond and writes to the KeyboardInterrupt console (Longpoll 5.90)

import vk_api
from vk_api.utils import get_random_id
from vk_api.bot_longpoll import VkBotLongPoll, VkBotEventType






vk_session = vk_api.VkApi(token="token")

vk = vk_session.get_api()
longpoll = VkBotLongPoll(vk_session, "198104184")

for event in longpoll.listen():
    if event.type == VkBotEventType.MESSAGE_NEW:
        if event.obj.text == 'тест':
            if event.from_chat:
                vk.messages.send(
                        random_id=get_random_id(),
                        peer_id=event.obj.peer_id,
                        message="bruh")

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alekssamos, 2020-08-26
@nintendolyub

Run like this:nohup ./bot.py &

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question