首页 > 解决方案 > 使用 mochawesome 的 Botium-cli 对话流:未定义的按钮

问题描述

按钮在机器人回复中有效,但在 mochawesome #bot 回复中未定义

示例 convo #bot BUTTON Pin Mailer

#me Pin 邮件程序

#bot 按钮拾取|返回菜单

#我捡起来

但在 mochawesome bot response undefined 我正在使用

botium-cli 运行 mochawesome。

截图 mochawesome 对话记录

标签: chatbotbotium-boxmochawesome

解决方案


目前,Botium CLI 中的 mochawesome 记者仅使用文本消息。

请参阅Github 存储库

  ...
  const messageLog = []
  const attachmentsLog = []
  const listenerMe = (container, msg) => {
    messageLog.push('#me: ' + msg.messageText)
    if (msg.attachments) attachmentsLog.push(...msg.attachments)
  }
  const listenerBot = (container, msg) => {
    messageLog.push('#bot: ' + msg.messageText)
    if (msg.attachments) attachmentsLog.push(...msg.attachments)
  }
  const listenerAttachments = (container, attachment) => {
    attachmentsLog.push(attachment)
  }
  driver.on('MESSAGE_SENTTOBOT', listenerMe)
  driver.on('MESSAGE_RECEIVEDFROMBOT', listenerBot)
  driver.on('MESSAGE_ATTACHMENT', listenerAttachments)
  ...

推荐阅读