我想創建一個樹型問題並回答bot與hubot做支持服務,我一直無法弄清楚如何。我希望Hubot對進入房間的人提問(使用robot.enter),但這與Rocket.Chat無關,我找到了解決方法。但是如果我想提出一個問題並等待用戶回覆以保存答覆並向他們提出另一個問題,那麼我該如何去做這件事?Hubot嵌套命令
我試着築巢甚至res.send,它不會讓我,讓我在CoffeeScript的
我想創建一個樹型問題並回答bot與hubot做支持服務,我一直無法弄清楚如何。我希望Hubot對進入房間的人提問(使用robot.enter),但這與Rocket.Chat無關,我找到了解決方法。但是如果我想提出一個問題並等待用戶回覆以保存答覆並向他們提出另一個問題,那麼我該如何去做這件事?Hubot嵌套命令
我試着築巢甚至res.send,它不會讓我,讓我在CoffeeScript的
指數誤差根據https://github.com/github/hubot/blob/master/docs/scripting.md 你可以使用:
robot.enter( RES) - > res.send res.random enterReplies
如果你想要的東西預建的,也有提供此功能的一對夫婦框架腳本:
https://github.com/lmarkus/hubot-conversation https://www.npmjs.com/package/hubot-dynamic-conversation
hubot,談話多一點JavaScripty(諷刺的是,多了幾分動態)你周圍建立會話流的JSON模式,而hubot-動態談話中心。
如果您不喜歡這兩個選項中的任何一個,您可以使用robot.listen混合動態地匹配消息和大腦來跟蹤狀態,從而實現自己的流程。
示例(我沒有實際測試過,但是應該給予正確的想法):
module.exports = (robot) ->
robot.respond /hello$/, (res) ->
res.reply 'Why hello there! How are you today?'
# Record that we are mid-conversation
convs = robot.brain.get('conversations')
convs = convs.push(message.user.name)
robot.brain.set('conversations', convs)
robot.listen(
# If we are mid-conversation, respond to whatever they say next
(message) -> message.user.name in robot.brain.get('conversations')
(response) ->
response.reply 'I hope you have a great rest of the day!'
# Record that we are done conversing
convs = robot.brain.get('conversations')
convs = convs.splice(convs.indexOf(message.user.name), 1)
robot.brain.set('conversations', convs)
)
胡博腦在這裏肯定會處理這種方式 –
不幸的是與Rocket.chat,robot.enter不起作用。這就是我說我試過以及最初 – asegier