You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the tutorial! I am just getting started with python and decided doing it with a bot it could be interesting.
One problem I stumbled upon is that the function parse_direct_mention don't match if the message contains valid FQDN - slack transforms them into links and the input is something like this <https://google.com|google.com>
Had a little bit of time today and it looks like when you sent this: @BOT google.com
it receives U4W3MKHKQ> ssh <http://google.com|google.com
and normal messages looks like that
U4W3MKHKQ
hi
Looks like it tries to remove the leading < and the last > from the return of that function. So the thing that removes < and > from the bot id, actually removes them from the whole message.
I think i figured it out, all we have to do is modify the regular expression. we just need to make the + non-greedy by changing it to +?. I'll send some PRs.
Activity
mattmakai commentedon Jan 24, 2018
hey @aoberoi, any idea on this potential
parse_direction_mentionURL handling quirk?aoberoi commentedon Jan 24, 2018
At a glance, I don’t see why the regex used wouldn’t work. But maybe I’m missing something. I’ll try to reproduce this soon.
idenkov commentedon Jan 30, 2018
Had a little bit of time today and it looks like when you sent this:
@BOT google.comit receives
U4W3MKHKQ> ssh <http://google.com|google.comand normal messages looks like that
Looks like it tries to remove the leading
<and the last>from the return of that function. So the thing that removes<and>from the bot id, actually removes them from the whole message.aoberoi commentedon Jan 30, 2018
@idenkov good detective work! i'll try to reproduce this now.
aoberoi commentedon Jan 30, 2018
I think i figured it out, all we have to do is modify the regular expression. we just need to make the
+non-greedy by changing it to+?. I'll send some PRs.makes username regex capture group non-greedy, fixes mattmakai#150
makes regex non-greedy, fixes mattmakai/fullstackpython.com#150
aoberoi commentedon Jan 30, 2018
@mattmakai please also merge mattmakai/slack-starterbot#9 when you get a chance.
Merge pull request #9 from aoberoi/regex-nongreedy
Merge pull request #151 from aoberoi/update-slack-bot-tut-regex
mattmakai commentedon Jan 30, 2018
thanks again @aoberoi, this is now merged and live. @idenkov everything work well on your end now?
idenkov commentedon Jan 30, 2018
Thanks, yep it works kind of lame took that bot id match for granted and didn't even think about it.
Merge pull request mattmakai#9 from aoberoi/regex-nongreedy