Не могу добавить человека в беседу ВК. Он подписан на группу, я ввожу /add 151315, где 151315 - это его ID и бот выдаёт ошибку:
vk.messages.addChatUser(chat_id = id, user_id = member_id)
File "C:\Users\Nagga\AppData\Local\Programs\Python\Python38\lib\site-packages\vk_api\vk_api.py", line 696, in __call__
return self._vk.method(self._method, kwargs)
File "C:\Users\Nagga\AppData\Local\Programs\Python\Python38\lib\site-packages\vk_api\vk_api.py", line 656, in method
raise error
vk_api.exceptions.ApiError: [27] Group authorization failed: method is unavailable with group auth.
import vk_api
from vk_api.utils import get_random_id
from vk_api.bot_longpoll import VkBotLongPoll, VkBotEventType
token_vk = 'мой токен'
autorizate = vk_api.VkApi(token = token_vk)
longpoll = VkBotLongPoll(autorizate, group_id = 201584840)
vk = autorizate.get_api()
while True:
for event in longpoll.listen():
if event.type == VkBotEventType.MESSAGE_NEW and event.from_chat and event.message.get('text'):
msg = event.message.get('text')
id = event.chat_id
uid = event.message.get('from_id')
if msg.split(' ')[0] == '/add':
try:
member_id = int(msg.split(' ')[1])
vk.messages.addChatUser(chat_id = id, user_id = member_id)
except:
vk.messages.send(message = 'Error.', random_id = get_random_id(), chat_id = id)