Answer the question
In order to leave comments, you need to log in
How to make the bot code for the VK group work [PYTHON]?
Here:
# -*- coding: utf-8 -*-
import vk_api
from vk_api.bot_longpoll import VkBotLongPoll, VkBotEventType
def main():
vk_session = vk_api.VkApi(token='#########################################')
longpoll = VkBotLongPoll(vk_session, '#####')
try:
vk_session.auth(token_only=True)
except vk_api.AuthError as error_msg:
print(error_msg)
return
for event in longpoll.listen():
if event.type == VkBotEventType.MESSAGE_NEW and event.to_me:
api.messages.send(peer_id=event.user_id, message='Привет!') !!!!Вот здесь мне выходит ошибка, что api не найдено
if __name__ == '__main__':
main()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question