Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

controller.hears not matching regular expressions correctly #80

@markstickley

Description

@markstickley

Using this code:

controller.hears('set volume (.*)','direct_message,direct_mention,mention', function(bot, message) {
    console.log(message);
});

I get this output:

{ type: 'message',
  channel: 'G0HNQCS23',
  user: 'U0A1H66FJ',
  text: 'set volume 50',
  ts: '1452007099.000065',
  team: 'T09JJJWKZ',
  event: 'direct_mention' }

There is no match property on message, just the text which I suppose does mean that the regex matched even if it didn't parse the brackets.

However if the regex is 'set volume (\d+)' matching the same text doesn't work (which I think it should).

Am I doing something wrong here?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions