Don't crash if the part message is null

This commit is contained in:
Mark Veidemanis 2019-08-15 22:14:45 +01:00
parent f34ddab6fc
commit 22bd0d3ac6
1 changed files with 9 additions and 8 deletions

View File

@ -175,14 +175,15 @@ class IRCBot(IRCClient):
castDup["type"] = "self" castDup["type"] = "self"
castDup["name"] = self.name castDup["name"] = self.name
if not cast["target"].lower() == self.nickname.lower(): # modes has been set on us directly if not cast["target"].lower() == self.nickname.lower(): # modes has been set on us directly
self.event(**castDup) # don't tell anyone else self.event(**castDup) # don't tell anyone else
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.lower() in cast["message"].lower(): if not cast["message"] == None:
castDup = deepcopy(cast) if self.nickname.lower() in cast["message"].lower():
castDup["mtype"] = cast["type"] castDup = deepcopy(cast)
castDup["type"] = "highlight" castDup["mtype"] = cast["type"]
castDup["name"] = self.name castDup["type"] = "highlight"
self.event(**castDup) castDup["name"] = self.name
self.event(**castDup)
if not "name" in cast.keys(): if not "name" in cast.keys():
cast["name"] = self.net cast["name"] = self.net
@ -380,8 +381,8 @@ class IRCBot(IRCClient):
if not channel in self.channels: if not channel in self.channels:
self.channels.append(channel) self.channels.append(channel)
self.names(channel).addCallback(self.got_names) self.names(channel).addCallback(self.got_names)
self.who(channel).addCallback(self.got_who)
if main.config["Toggles"]["Who"]: if main.config["Toggles"]["Who"]:
self.who(channel).addCallback(self.got_who)
lc = LoopingCall(self.who, channel) lc = LoopingCall(self.who, channel)
self._getWho[channel] = lc self._getWho[channel] = lc
intrange = main.config["Tweaks"]["Delays"]["WhoRange"] intrange = main.config["Tweaks"]["Delays"]["WhoRange"]