Написал бота для вк, выдает ошибку что не удается импортировать VkBotLongPoll, как исправить?

import vk_api
from vk_api.bot_longpoll import VkBotLongPoll, VkBotEventType
import random
from vk_api.longpoll import VkBotLongPoll, VkEventType
ben = ['yes', 'no', 'axaxaxa', 'agrho']

vk_session = vk_api.VkApi(token = 'тут api если что')

longpoll = VkBotLongPoll(vk_session, 210948008)


def sender(id, text):
    vk_session.method('messages.send', {'chat_id' : id,  'message' : text, 'random_id': 0})



for event in longpoll.listen():
    if event.type == VkEventType.MESSAGE_NEW:
        if event.from_chat:




            id = event.chat_id
            message = event.object.message["text"].lower()
            try:
                dey = event.message.action['type']
                invite = event.message.action['member_id']
            except:
                dey = ''
                invite_id = -100
                if dey == 'chat_invite_user':
                    sender(id, 'бен?, @id{invite_id}')
                if message == 'тут текст':
                    sender(id,  'yes')
                elif message == 'тут текст':
                    sender(id, 'yes')
                elif message == 'тут текст':
                    sender(id, 'yes')
                elif message == 'тут текст':
                    sender(id, 'yes')
                elif message == 'тут текст':
                    sender(id, 'yes' )
                else:
                    sender(id, random.choice(ben))

и ошибка:
C:\Users\artyr\Desktop\BenBot\venv\Scripts\python.exe C:/Users/artyr/Desktop/BenBot/venv/ben.py
Traceback (most recent call last):
File "C:\Users\artyr\Desktop\BenBot\venv\ben.py", line 4, in
from vk_api.longpoll import VkBotLongPoll, VkEventType
ImportError: cannot import name 'VkBotLongPoll' from 'vk_api.longpoll' (C:\Users\artyr\Desktop\BenBot\venv\lib\site-packages\vk_api\longpoll.py)
  • Вопрос задан
  • 111 просмотров
Пригласить эксперта
Ответы на вопрос 1
Da222
@Da222
У тебя 2 и 4 строка повторяется.
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы