Only match eligible exclude statements and make sure legitimate keywords get through
This commit is contained in:
parent
6569314267
commit
1b0217e0a6
10
threshold
10
threshold
|
@ -306,6 +306,7 @@ class Helper(object):
|
||||||
|
|
||||||
def isKeyword(self, msg):
|
def isKeyword(self, msg):
|
||||||
message = msg.lower()
|
message = msg.lower()
|
||||||
|
messageDuplicate = message
|
||||||
toUndo = False
|
toUndo = False
|
||||||
uniqueNum = 0
|
uniqueNum = 0
|
||||||
totalNum = 0
|
totalNum = 0
|
||||||
|
@ -315,11 +316,19 @@ class Helper(object):
|
||||||
for x in config["KeywordsExcept"][i]:
|
for x in config["KeywordsExcept"][i]:
|
||||||
if x in message:
|
if x in message:
|
||||||
toUndo = True
|
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:
|
if toUndo == False:
|
||||||
totalNum += message.count(i)
|
totalNum += message.count(i)
|
||||||
message = message.replace(i, "{"+i+"}")
|
message = message.replace(i, "{"+i+"}")
|
||||||
uniqueNum += 1
|
uniqueNum += 1
|
||||||
|
|
||||||
toUndo = False
|
toUndo = False
|
||||||
|
|
||||||
if totalNum == 0:
|
if totalNum == 0:
|
||||||
|
@ -789,6 +798,7 @@ if __name__ == "__main__":
|
||||||
config = helper.getConfig()
|
config = helper.getConfig()
|
||||||
pool = helper.getPool()
|
pool = helper.getPool()
|
||||||
help = helper.getHelp()
|
help = helper.getHelp()
|
||||||
|
|
||||||
for i in pool.keys():
|
for i in pool.keys():
|
||||||
if pool[i]["enabled"] == True:
|
if pool[i]["enabled"] == True:
|
||||||
helper.addBot(i)
|
helper.addBot(i)
|
||||||
|
|
Loading…
Reference in New Issue