Convert nickname and messages to lowercase before comparison

pull/1/head
Mark Veidemanis 5 years ago
parent 2757256d4f
commit 3a92ebab6b

@ -151,7 +151,7 @@ class IRCBot(IRCClient):
del cast["target"]
if not cast["type"] in ["query", "self", "highlight", "znc", "who"]:
if "target" in cast.keys():
if cast["target"] == self.nickname:
if cast["target"].lower() == self.nickname.lower():
#castDup = deepcopy(cast)
cast["mtype"] = cast["type"]
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
# channel, but we still want to see them
if "user" in cast.keys():
if cast["user"] == self.nickname:
if cast["user"].lower() == self.nickname.lower():
castDup = deepcopy(cast)
castDup["mtype"] = cast["type"]
castDup["type"] = "self"
castDup["name"] = self.name
self.event(**castDup)
if "nick" in cast.keys():
if cast["nick"] == self.nickname:
if cast["nick"].lower() == self.nickname.lower():
castDup = deepcopy(cast)
castDup["mtype"] = cast["type"]
castDup["type"] = "self"
castDup["name"] = self.name
self.event(**castDup)
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["mtype"] = cast["type"]
castDup["type"] = "highlight"

Loading…
Cancel
Save