Не отвечает в беседу, вот код:
import random
import vk_api
from vk_api.longpoll import VkLongPoll, VkEventType
from commander.commander import Commander
def write_msg(user_id, message):
vk.method('messages.send', {'peer_id': user_id, 'message': message, 'random_id': random.randint(-2147483648, +2147483648)})
token = СЕКРЕТ
vk = vk_api.VkApi(token=token)
longpoll = VkLongPoll(vk)
commander = Commander()
print("Бот запущен")
for event in longpoll.listen():
if event.type == VkEventType.MESSAGE_NEW:
if event.to_me:
request = event.text
if request == "о семье":
f = open('family.txt',mode = 'r',encoding = 'utf-8')
write_msg(event.peer_id, f.read())
f.close()
print("log: succeful send")