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

Case sensitive "hears" #90

Closed
davedelong opened this issue Jan 13, 2016 · 3 comments
Closed

Case sensitive "hears" #90

davedelong opened this issue Jan 13, 2016 · 3 comments

Comments

@davedelong
Copy link

It'd be nice if there were a way to make .hears have a case sensitive option. That way our bot can be a proper grammar nazi. 😈

@bobvanluijt
Copy link

You can do this with a regex.

"(?=SomETHinG).*(?=FooBar)" // matches exactly
"/(?=SomETHinG).*(?=FooBar)/i" // matches also something and foobar... 

@anonrig anonrig closed this as completed Feb 23, 2016
@mvaragnat
Copy link
Contributor

I tried controller.hears("/help/i", ...
it did not work

I have to use controller.hears(['^help', '^Help'],...

What am I doing wrong?

@bobvanluijt
Copy link

@mvaragnat you can do two things.

  1. If you want the bot the respond to any form of 'help' just use .hears(['help'])
  2. If 1 isn't suitable, use a regex (see my previous answer)

In you case option 1 seems ok.

PS:
If you have multiple hear() functions with 'help' you need to use a regex too.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants