не могу понять в чём проблема

Ошибка:

Traceback (most recent call last):
  File "C:\programist\bot.py", line 6, in <module>
    longpoll = VkBotLongPoll(vk_session, 202150586)
  File "C:\Users\agonc\AppData\Local\Programs\Python\Python39\lib\site-packages\vk_api\bot_longpoll.py", line 219, in __init__
    self.update_longpoll_server()
  File "C:\Users\agonc\AppData\Local\Programs\Python\Python39\lib\site-packages\vk_api\bot_longpoll.py", line 232, in update_longpoll_server
    response = self.vk.method('groups.getLongPollServer', values)
  File "C:\Users\agonc\AppData\Local\Programs\Python\Python39\lib\site-packages\vk_api\vk_api.py", line 656, in method
    raise error
vk_api.exceptions.ApiError: [5] User authorization failed: invalid session.

Код:

import vk_api
from vk_api.bot_longPoll import VkBotLongpoll, VkBotEventType
from config import tok


vk_session = vk_api.VkApi(token = tok)
longpoll = VkBotLongPoll(vk_session, 202150586)

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 == VkBotEventType.MESSAGE_NEW:
        if event.from_chat:

            id = event.chat_id
            msg = event.object.message['text'].lower()

            if msg == 'привет':
                sender(id, 'не ну это бан')
    

Ответы (0 шт):