diff --git a/threshold b/threshold index d9c1e81..301849b 100755 --- a/threshold +++ b/threshold @@ -306,6 +306,7 @@ class Helper(object): def isKeyword(self, msg): message = msg.lower() + messageDuplicate = message toUndo = False uniqueNum = 0 totalNum = 0 @@ -315,11 +316,19 @@ class Helper(object): for x in config["KeywordsExcept"][i]: if x in message: toUndo = True + messageDuplicate = messageDuplicate.replace(x, "\0\r\n\n\0") + for y in config["Keywords"]: + if i in messageDuplicate: + totalNum += messageDuplicate.count(i) + message = messageDuplicate.replace(i, "{"+i+"}") + message = message.replace("\0\r\n\n\0", x) + uniqueNum += 1 + + if toUndo == False: + totalNum += message.count(i) + message = message.replace(i, "{"+i+"}") + uniqueNum += 1 - if toUndo == False: - totalNum += message.count(i) - message = message.replace(i, "{"+i+"}") - uniqueNum += 1 toUndo = False if totalNum == 0: @@ -789,6 +798,7 @@ if __name__ == "__main__": config = helper.getConfig() pool = helper.getPool() help = helper.getHelp() + for i in pool.keys(): if pool[i]["enabled"] == True: helper.addBot(i)