首页 文章

如何在Botkit消息处理程序中获取原始消息文本(例如电子邮件地址)

提问于
浏览
0

在botkit中我设置 message_received 或任何其他处理程序 . 当我收到消息时,它的 text 属性应该包含用户写的实际消息 . 不幸的是,此消息包含例如电子邮件地址我得到这个消息松弛格式 . 例:

用户输入: Hey, send an email to foo@bar.com

botkit给了我: Hey, send an email to <mailto:foo@bar.com|foo@bar.com>

有没有办法以原始形式获得它,或者我应该手动展开吗?

1 回答

  • 0

    做类似的事情:

    var matches = response.text.match(/\|.*>/)
    log.info("Matches : " + matches)
    if (matches) {
        mail = matches[0].substring(1, matches[0].length - 1)
        log.info("Mail : " + mail)
    }
    

相关问题