如何在Botkit消息处理程序中获取原始消息文本(例如电子邮件地址)
在botkit中,我设置了message_received
或其他处理程序。 当我收到消息时,其text
属性应该包含用户写的实际消息。 不幸的是,当这个消息包含例如电子邮件地址,我得到这个消息松弛格式。 例:
用户input: Hey, send an email to foo@bar.com
botkit给我: Hey, send an email to <mailto:foo@bar.com|foo@bar.com>
有没有办法以原始forms得到它,还是我应该用手解开呢?
做类似的事情:
var matches = response.text.match(/\|.*>/) log.info("Matches : " + matches) if (matches) { mail = matches[0].substring(1, matches[0].length - 1) log.info("Mail : " + mail) }