From 9506d3d1f40d65fc38695f1954dcb4855126271c Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Sat, 2 Dec 2017 19:49:00 +0000 Subject: [PATCH] Fix counting of nickname highlights --- threshold | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/threshold b/threshold index c32a25c..99a4659 100755 --- a/threshold +++ b/threshold @@ -88,9 +88,10 @@ class IRCBot(IRCClient): else: if config["HighlightNotifications"]: msgLower = msg.lower() - if self.nickname.lower() in msgLower: - msgLower = msgLower.replace(self.nickname, "{"+self.nickname+"}") - helper.sendMaster("NICK PRV %s (T:%s): (%s/%s) %s" % (self.name, msg.count(self.nickname), user, channel, msgLower)) + nickLower = self.nickname.lower() + if nickLower in msgLower: + msgLower = msgLower.replace(nickLower, "{"+nickLower+"}") + helper.sendMaster("NICK PRV %s (T:%s): (%s/%s) %s" % (self.name, msgLower.count(nickLower), user, channel, msgLower)) if toSend: helper.sendMaster("MATCH PRV %s (U:%s T:%s): (%s/%s) %s" % (self.name, toSend[1], toSend[2], user, channel, toSend[0])) @@ -101,9 +102,10 @@ class IRCBot(IRCClient): else: if config["HighlightNotifications"]: msgLower = msg.lower() - if self.nickname.lower() in msgLower: - msgLower = msgLower.replace(self.nickname, "{"+self.nickname+"}") - helper.sendMaster("NICK NOT %s (T:%s): (%s/%s) %s" % (self.name, msg.count(self.nickname), user, channel, msgLower)) + nickLower = self.nickname.lower() + if nickLower in msgLower: + msgLower = msgLower.replace(nickLower, "{"+nickLower+"}") + helper.sendMaster("NICK NOT %s (T:%s): (%s/%s) %s" % (self.name, msgLower.count(nickLower), user, channel, msgLower)) if toSend: helper.sendMaster("MATCH NOT %s (U:%s T:%s): (%s/%s) %s" % (self.name, toSend[1], toSend[2], user, channel, toSend[0])) @@ -114,9 +116,10 @@ class IRCBot(IRCClient): else: if config["HighlightNotifications"]: msgLower = msg.lower() - if self.nickname.lower() in msgLower: - msgLower = msgLower.replace(self.nickname, "{"+self.nickname+"}") - helper.sendMaster("NICK ACT %s (T:%s): (%s/%s) %s" % (self.name, msg.count(self.nickname), user, channel, msgLower)) + nickLower = self.nickname.lower() + if nickLower in msgLower: + msgLower = msgLower.replace(nickLower, "{"+nickLower+"}") + helper.sendMaster("NICK ACT %s (T:%s): (%s/%s) %s" % (self.name, msgLower.count(nickLower), user, channel, msgLower)) if toSend: helper.sendMaster("MATCH ACT %s (U:%s T:%s): (%s/%s) %s" % (self.name, toSend[1], toSend[2], user, channel, toSend[0]))