import vk_api
from vk_api.bot_longpoll import VkBotLongPoll, VkBotEventType
from sets import main_token
vk_session = vk_api.VkApi(token=main_token)
vk_session._auth_token()
vk_session.get_api()
longpoll = VkBotLongPoll(vk_session, 202184443)
def sender(peer_id: int, message: str, attachment: str = ""):
return vk.method("messages.send", {**locals(), "random_id": 0})
for event in longpoll.listen():
if event.type == VkBotEventType.MESSAGE_NEW:
if event.object.peer_id != event.object.from_id:
if event.object.text == "Привет":
sender(event.obj.peer_id, "Пока")
бот работает только в беседе привязанной к сообществу.Что делать?