Код:
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, 207817235)
def sender(id, text):
vk_session.method('messages.get', {'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.lower()
if msg == ‘Привет’:
sender(id, ‘Приветсвую!’)
пишу его на Sublime Text
вот полная ошибка при билде
Traceback (most recent call last):
File “D:\My\Bot VK\main.py”, line 6, in <module>
longpoll = VkBotLongPoll(vk_session, 207817235)
File “C:\Users\WWW\AppData\Local\Programs\Python\Python310\lib\site-packages\vk_api\bot_longpoll.py”, line 219, in __init__
self.update_longpoll_server()
File “C:\Users\WWW\AppData\Local\Programs\Python\Python310\lib\site-packages\vk_api\bot_longpoll.py”, line 232, in update_longpoll_server
response = self.vk.method('groups.getLongPollServer', values)
File “C:\Users\WWW\AppData\Local\Programs\Python\Python310\lib\site-packages\vk_api\vk_api.py”, line 668, in method
raise error
vk_api.exceptions.ApiError: Access denied: no access to call this method
ЧТО ДЕЛАТЬ?)