I just started playing with hubot-slack, so forgive if this is a noob question.
I tried setting up this simple example to test with:
https://github.com/sapg/hubot-scripts/blob/master/shell-command.coffee
I type: host lookup www.domain.com
but I am getting back:
Looking up http://www.domain.com...
It seems that slack is parsing the domain name automatically and I am getting a url back in hubot rather than the original string. Is there a way to get the message "non-url-ified?"
I'm having a similar problem. A hubot script I have will reply to a command with https://somedomain.com (amongst other content), but when it's posted in slack it will be https://http://somedomain.com. In another case, the script will reply with somedomain.com(important) but in Slack it'll be http://somedomain.com
Is there a way around this?
any plan to fix this bug?
This shouldn't be a problem. hubot-slack strips out the link formatting, returning a message text that if you type
host lookup www.domain.com
the script should receive message text
host lookup www.domain.com
despite whatever link decoration that Slack adds to the message. (with the original formatted message available in the message rawText)
Can you confirm to me that this is still a bug with steps to reproduce?
closing since no response.
sorry for not posting a follow-up.
I haven't updated hubot in a while, so don't know if this was fixed in a more recent version, but a simple workaround I found a while back was this:
hostname = msg.match[1].replace /http:\/\//, ""
@rb1980 I know its been a while since you probably thought about this, but I have a more proper workaround, if it works for you
/* Get the raw text of the arguments */
var args_string = msg.message.rawText.trim();
/* Parse any auto generated http links from slack that were not intentional and just replace it with the full text */
var httplink = /<(http:\/\/.*)\|(.*)>/i
var http_match = args_string.match(httplink)
if (http_match) { args_string = args_string.replace(http_match[0], http_match[2]) }
Most helpful comment
@rb1980 I know its been a while since you probably thought about this, but I have a more proper workaround, if it works for you