Vk聊天机器人与python + vk_api



我正在尝试做vk聊天机器人,但有一个例外

import vk_api
import time
import json
token = 'ea8d297a7***3fd45e98fd0f2b0215954d854a0'
vk = vk_api.VkApi(token=token)
vk._auth_token() # vk.auth() doesn't work
print(  # Getting chat info
vk.method('messages.getConversations')
)
keyboard = {'one_time':True,
'buttons':
[
[
{'action':
{'type':'text', 
'label':'This is keyboard!'},
'color':'Positive',
}
]
]
}
my_id = vk.method('messages.getConversations')['items'][0]['last_message']['from_id']
# my_id - id of the last message in the chat
vk.method('messages.send', 
{'user_id':my_id, 
'message':'Keyboard to the studio!',
'keyboard':str(json.dumps(keyboard))
})

vk_api.exceptions.ApiError: [912] This is a chat bot feature, change this status in settings

vk.method('messages.send', .....发生它。 我想用键盘发送用户消息。我该怎么做,为什么会发生此错误?感谢您的任何帮助!

您应该转到"社区管理" ->"消息" ->"机器人设置"并启用" 机器人功能">

最新更新