Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hubot not responding to @-mentions #106

Closed
redhotvengeance opened this issue Dec 9, 2014 · 15 comments · Fixed by #120
Closed

Hubot not responding to @-mentions #106

redhotvengeance opened this issue Dec 9, 2014 · 15 comments · Fixed by #120
Labels
bug

Comments

@redhotvengeance
Copy link
Contributor

@redhotvengeance redhotvengeance commented Dec 9, 2014

With the new version (v3), Hubot can now have a username - yay! But @-mentioning Hubot by its username doesn't seem to work. For instance, this fails:

@hubot image me corgi

...while this succeeds:

hubot image me corgi

It looks like Hubot is only looking for its strict username (hubot) and the @ symbol is causing it to not register its name (@hubot). But think the expectation would be that @-mentioning Hubot would be like sending a command directly to it, and @hubot image me corgi == hubot image me corgi.

@grantmd

This comment has been minimized.

Copy link
Contributor

@grantmd grantmd commented Dec 9, 2014

It should, you're right. Will take a look (thought I fixed this at one point).

@lxfontes

This comment has been minimized.

Copy link

@lxfontes lxfontes commented Dec 9, 2014

side effect of that, it also listens to its own messages. Ex: 'hubot help'

@lxfontes

This comment has been minimized.

Copy link

@lxfontes lxfontes commented Dec 9, 2014

scratch that. had 2 bots (old ver + new ver) on the same channel yelling at each other.

@evansolomon

This comment has been minimized.

Copy link
Collaborator

@evansolomon evansolomon commented Dec 9, 2014

had 2 bots (old ver + new ver) on the same channel yelling at each other

The mental image of this made me laugh

@evansolomon

This comment has been minimized.

Copy link
Collaborator

@evansolomon evansolomon commented Dec 9, 2014

I haven't dug in very deeply, but it seems like this part of the hubot core should handle the @-mention case for us. Not sure what's going wrong.

@redhotvengeance

This comment has been minimized.

Copy link
Contributor Author

@redhotvengeance redhotvengeance commented Dec 9, 2014

@evansolomon I dug into the debug logs and found what seems to be the issue. hubot image me corgi logs:

[Tue Dec 09 2014 21:19:31 GMT+0000 (UTC)] DEBUG Received message: 'hubot image me corgi' in channel: my-hubot-sandbox, from: redhotvengeance

...while @hubot image me corgi logs:

[Tue Dec 09 2014 21:20:17 GMT+0000 (UTC)] DEBUG Received message: '<@U0352NXHB>: image me corgi' in channel: my-hubot-sandbox, from: redhotvengeance

It looks as though @-mentions get converted into an internal Slack id, so the regex fails because it is expecting the bot name rather than the Slack id.

@spdustin

This comment has been minimized.

Copy link
Contributor

@spdustin spdustin commented Dec 9, 2014

As a temporary workaround, I listed the User IDs for all users via the api (just click the "go" button once you're signed in over there, gentle reader). Once I got the User ID for the hubot bot account from the API response, I updated my procfile to include that User ID (inside angle brackets and prefixed with the @ sign) as an alias, like so:

web: bin/hubot -a slack -n botnamegoeshere -l "<@useridgoeshere>" 
@evansolomon

This comment has been minimized.

Copy link
Collaborator

@evansolomon evansolomon commented Dec 9, 2014

@spdustin clever, just worth noting that doing that probably creates the opposite condition where "botname hello" no longer triggers a response

@spdustin

This comment has been minimized.

Copy link
Contributor

@spdustin spdustin commented Dec 9, 2014

Nope, that still works, because it's an alias. So in the above example, botnamegoeshere or @botnamegoeshere (which is converted to the internal user ID by the time it gets to hubot) both work just fine.

@spdustin

This comment has been minimized.

Copy link
Contributor

@spdustin spdustin commented Dec 9, 2014

What's funny is when you have slackbot responses set up for phrases that hubot says (like "ship it"). Our bot is named Christopher Walken (walken) and I keep imagining him getting all angry and up in slackbot's face.

@evansolomon

This comment has been minimized.

Copy link
Collaborator

@evansolomon evansolomon commented Dec 9, 2014

Oh interesting, thanks for explaining the alias.

@spdustin

This comment has been minimized.

Copy link
Contributor

@spdustin spdustin commented Dec 9, 2014

As a note for others coming in to this thread

  • The<@botuserid> form is necessary as the alias because Slack adds formatting around mentions so that clients can understand it's a mention
  • Hubot will listen for his name (specified as the -n argument value) by default - you can also add an alias (specified as the -l argument value) and he'll listen for that, too
  • Hubot doesn't care about "mentions" as a special type, only the raw text that the chat service gives to him

use of gender-specific pronouns not at all meant to imply that hubot has an actual gender

@spdustin

This comment has been minimized.

Copy link
Contributor

@spdustin spdustin commented Dec 9, 2014

I wonder if 🐞 #9 needs to be revisited ... apparently, slack was "fixed" earlier by @grantmd to not format the text going to hubots.

@paulhammond paulhammond added the bug label Dec 10, 2014
@altryne

This comment has been minimized.

Copy link

@altryne altryne commented Dec 10, 2014

I can confirm that @spdustin fix works for both @ mentions and jsut writing 'hubot'
Thanx!

@paulhammond

This comment has been minimized.

Copy link
Contributor

@paulhammond paulhammond commented Dec 16, 2014

I've just fixed this "properly" in #120, which will be in the next release (hopefully today!)

@spdustin: Thank you for the interim workaround!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.