Answer the question
In order to leave comments, you need to log in
The problem is in the VK bot, it does not work! How to fix it?
Code part:
9 vk_session = vk_api.VkApi(token=token)
10
11 vk = vk_session.get_api()
12 longpoll = VkLongPoll(vk_session)
Traceback (most recent call last):
File "C:/Users/Deazm/Desktop/twitch/Bots/Vk/im/bot.py", line 11, in <module>
longpoll = VkLongPoll(vk_session)
File "C:\Users\Deazm\AppData\Local\Programs\Python\Python36\lib\site-packages\vk_api\longpoll.py", line 503, in __init__
self.update_longpoll_server()
File "C:\Users\Deazm\AppData\Local\Programs\Python\Python36\lib\site-packages\vk_api\longpoll.py", line 513, in update_longpoll_server
response = self.vk.method('messages.getLongPollServer', values)
File "C:\Users\Deazm\AppData\Local\Programs\Python\Python36\lib\site-packages\vk_api\vk_api.py", line 636, in method
raise error
vk_api.exceptions.ApiError: [15] Access denied: no access to call this method
Answer the question
In order to leave comments, you need to log in
import vk_api #Библиотека VK API
from vk_api.bot_longpoll import VkBotLongPoll, VkBotEventType #Библиотека VK LongPool
vk_session = vk_api.VkApi(token = 'сюда токен') # Обработка access_token
longpoll = VkBotLongPoll(vk_session, 'сюда ид группы') # Данные для работы в сообществе
vk = vk_session.get_api() # Работа с VK API
for event in longpoll.listen():
if event.type == VkBotEventType.MESSAGE_NEW:
print('Новое сообщение')
time.sleep(longpool_sleep)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question