diff --git a/example.json b/example.json index f7e7250..aa7543c 100644 --- a/example.json +++ b/example.json @@ -6,6 +6,7 @@ "ListenerCertificate": "cert.pem", "UsePassword": true, "ConnectOnCreate": false, + "HighlightNotifications": true, "Password": "s", "Default": { "password": null, diff --git a/threshold b/threshold index ed4dca7..c32a25c 100755 --- a/threshold +++ b/threshold @@ -83,26 +83,41 @@ class IRCBot(IRCClient): def privmsg(self, user, channel, msg): toSend = helper.isKeyword(msg) - if toSend: - if self.name == config["Master"][0] and channel == config["Master"][1]: - pass - else: + if self.name == config["Master"][0] and channel == config["Master"][1]: + pass + 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)) + if toSend: helper.sendMaster("MATCH PRV %s (U:%s T:%s): (%s/%s) %s" % (self.name, toSend[1], toSend[2], user, channel, toSend[0])) def noticed(self, user, channel, msg): toSend = helper.isKeyword(msg) - if toSend: - if self.name == config["Master"][0] and channel == config["Master"][1]: - pass - else: + if self.name == config["Master"][0] and channel == config["Master"][1]: + pass + 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)) + if toSend: helper.sendMaster("MATCH NOT %s (U:%s T:%s): (%s/%s) %s" % (self.name, toSend[1], toSend[2], user, channel, toSend[0])) def action(self, user, channel, msg): toSend = helper.isKeyword(msg) - if toSend: - if self.name == config["Master"][0] and channel == config["Master"][1]: - pass - else: + if self.name == config["Master"][0] and channel == config["Master"][1]: + pass + 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)) + if toSend: helper.sendMaster("MATCH ACT %s (U:%s T:%s): (%s/%s) %s" % (self.name, toSend[1], toSend[2], user, channel, toSend[0])) def get(self, var):