From 3a92ebab6bc421df7e569023363543d36368b8a2 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Sun, 11 Aug 2019 20:53:26 +0100 Subject: [PATCH] Convert nickname and messages to lowercase before comparison --- core/bot.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/bot.py b/core/bot.py index bc7a6f5..d06c32b 100644 --- a/core/bot.py +++ b/core/bot.py @@ -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"