lib/irc: make isHighlight operate on messages

Makes it easier to re-use elsewhere.
This commit is contained in:
Simon Ser
2020-08-13 11:44:41 +02:00
parent 11660e4409
commit 917b348992
2 changed files with 10 additions and 2 deletions

View File

@@ -219,7 +219,15 @@ function isWordBoundary(ch) {
}
}
export function isHighlight(text, nick) {
export function isHighlight(msg, nick) {
if (msg.command != "PRIVMSG" && msg.command != "NOTICE") {
return false;
}
if (msg.prefix.name == nick) {
return false; // Our own messages aren't highlights
}
var text = msg.params[1];
while (true) {
var i = text.indexOf(nick);
if (i < 0) {