Skip to content

Instantly share code, notes, and snippets.

@jonasbits
Created February 13, 2016 23:52
Show Gist options
  • Save jonasbits/c82793c80fabadad0e43 to your computer and use it in GitHub Desktop.
Save jonasbits/c82793c80fabadad0e43 to your computer and use it in GitHub Desktop.
stalk words for cIRC
NickMentionedNotification.shouldNotify = function(nick, msg) {
var msgToTest;
if (!(nick != null)) {
return false;
}
nick = nick.replace(/_+$/, '');
nick = this._escapeTextForRegex(nick);
msgToTest = this._prepMessageForRegex(msg, nick);
if ( /bitcoin_*([!?.]*|[-:;~\*\u0001]?)(?!\S)/i.test(msgToTest) ) {
return true;
}
return /\#nick\#_*([!?.]*|[-:;~\*\u0001]?)(?!\S)/i.test(msgToTest);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment