slackapi/hubot-slack

Match on raw text instead of formatted text on incoming messages

開放

#241 建立於 2015年10月9日

 (3 則留言) (0 個反應) (0 位負責人)CoffeeScript (637 個分叉)batch import
enhancementgood first issue

倉庫指標

星標
 (2,339 顆星)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

This was originally filed at https://github.com/github/hubot/issues/1053 but I believe this to be an adapter specific problem. From @callumacrae:

We have a script which starts like this:

robot.hear /some sentence here/i, (msg) ->

However, it doesn't hear it if the words are formatted at all, e.g. "some sentence here".

Would it be possible / desired to remove formatting from messages before parsing them?

I suggested this:

Slack already has a place it strips formatting for links. That'd be a good place to do it for other things: https://github.com/slackhq/hubot-slack/blob/master/src/slack.coffee#L153-L192

I think it is going to be up to the adapters to strip formatting like this. They probably should preserve the raw message in case an adapter-specific script wants to do something about, like hubot-slack does here: https://github.com/slackhq/hubot-slack/blob/master/src/slack.coffee#L112-L120

貢獻者指南