Ошибка "Возникло исключение: AttributeError"

Rubinov

Новичок
Пользователь
Мар 14, 2024
1
0
1
Python:
import vk_api
import utils
from vk_api.bot_longpoll import VkBotEvent, VkBotLongPoll
from models import User
from information import *

class MyLongPoll(VkBotLongPoll):
    def listen(self):
        while True:
            try:
                for event in self.check():
                    yield event
            except Exception as e:
                print(e)

class VkBot:
    def __init__(self):
        self.vk_session = vk_api.VkApi(token=token)
        self.longpoll = VkBotLongPoll(self.vk_session, 0)#здесь есть id группы, специально убрал

def run(self):
    for event in self.longpoll.listen():
        if event.type == VkBotEventType.MEGGAGE_NEW:
            msg = event.object.message
            user_id = msg['from_id']
            user = utils.get_user_by_id(user_id)
            text = msg['text']
            fwd = self.vk_session.method('messages.getByConversationMessageId',
                                         {'conversation_message_ids': msg['conversation_message_id'],
                                          'peer_id': msg['peer_id']
                                         })
            print(user_id, text, fwd)



if __name__ == '__main__':
    VkBot().run()
 

4olshoy_blen

Популярный
Пользователь
Ноя 13, 2022
374
108
43
Где полный трэйсбек ошибки? Или предлагаешь нам самим её найти?
 

Форум IT Специалистов