Convert nickname and messages to lowercase before comparison

This commit is contained in:
Mark Veidemanis 2019-08-11 20:53:26 +01:00
parent 2757256d4f
commit 3a92ebab6b
1 changed files with 4 additions and 4 deletions

View File

@ -151,7 +151,7 @@ class IRCBot(IRCClient):
del cast["target"] del cast["target"]
if not cast["type"] in ["query", "self", "highlight", "znc", "who"]: if not cast["type"] in ["query", "self", "highlight", "znc", "who"]:
if "target" in cast.keys(): if "target" in cast.keys():
if cast["target"] == self.nickname: if cast["target"].lower() == self.nickname.lower():
#castDup = deepcopy(cast) #castDup = deepcopy(cast)
cast["mtype"] = cast["type"] cast["mtype"] = cast["type"]
cast["type"] = "query" cast["type"] = "query"
@ -160,21 +160,21 @@ class IRCBot(IRCClient):
# Don't call self.event for this one because queries are not events on a # Don't call self.event for this one because queries are not events on a
# channel, but we still want to see them # channel, but we still want to see them
if "user" in cast.keys(): if "user" in cast.keys():
if cast["user"] == self.nickname: if cast["user"].lower() == self.nickname.lower():
castDup = deepcopy(cast) castDup = deepcopy(cast)
castDup["mtype"] = cast["type"] castDup["mtype"] = cast["type"]
castDup["type"] = "self" castDup["type"] = "self"
castDup["name"] = self.name castDup["name"] = self.name
self.event(**castDup) self.event(**castDup)
if "nick" in cast.keys(): if "nick" in cast.keys():
if cast["nick"] == self.nickname: if cast["nick"].lower() == self.nickname.lower():
castDup = deepcopy(cast) castDup = deepcopy(cast)
castDup["mtype"] = cast["type"] castDup["mtype"] = cast["type"]
castDup["type"] = "self" castDup["type"] = "self"
castDup["name"] = self.name castDup["name"] = self.name
self.event(**castDup) self.event(**castDup)
if "message" in cast.keys() and not cast["type"] == "query": # Don't highlight queries if "message" in cast.keys() and not cast["type"] == "query": # Don't highlight queries
if self.nickname in cast["message"]: if self.nickname.lower() in cast["message"].lower():
castDup = deepcopy(cast) castDup = deepcopy(cast)
castDup["mtype"] = cast["type"] castDup["mtype"] = cast["type"]
castDup["type"] = "highlight" castDup["type"] = "highlight"