Rename 'message' to 'msg' and 'target' to 'channel'

This commit is contained in:
2019-10-05 00:51:00 +01:00
parent ddadeb617c
commit 78e4d6bd66
3 changed files with 25 additions and 25 deletions

View File

@@ -149,10 +149,10 @@ class IRCBot(IRCClient):
del cast["nick"]
del cast["ident"]
del cast["host"]
del cast["target"]
del cast["channel"]
if not cast["type"] in ["query", "self", "highlight", "znc", "who"]:
if "target" in cast.keys() and not cast["type"] == "mode": # don't handle modes here
if cast["target"].lower() == self.nickname.lower(): # as they are target == nickname
if "channel" in cast.keys() and not cast["type"] == "mode": # don't handle modes here
if cast["channel"].lower() == self.nickname.lower(): # as they are channel == nickname
#castDup = deepcopy(cast) # however modes are not queries!
cast["mtype"] = cast["type"]
cast["type"] = "query"
@@ -173,7 +173,7 @@ class IRCBot(IRCClient):
castDup["mtype"] = cast["type"]
castDup["type"] = "self"
castDup["name"] = self.name
if not cast["target"].lower() == self.nickname.lower(): # modes has been set on us directly
if not cast["channel"].lower() == self.nickname.lower(): # modes has been set on us directly
self.event(**castDup) # don't tell anyone else
if "msg" in cast.keys() and not cast["type"] == "query": # Don't highlight queries
if not cast["msg"] == None:
@@ -190,13 +190,13 @@ class IRCBot(IRCClient):
monitor.event(self.name, cast)
def privmsg(self, user, channel, msg):
self.event(type="msg", muser=user, target=channel, msg=msg)
self.event(type="msg", muser=user, channel=channel, msg=msg)
def noticed(self, user, channel, msg):
self.event(type="notice", muser=user, target=channel, msg=msg)
self.event(type="notice", muser=user, channel=channel, msg=msg)
def action(self, user, channel, msg):
self.event(type="action", muser=user, target=channel, msg=msg)
self.event(type="action", muser=user, channel=channel, msg=msg)
def get(self, var):
try:
@@ -251,7 +251,7 @@ class IRCBot(IRCClient):
return
n = self._tempWho[channel][1]
n.append([nick, nick, host, server, status, realname])
self.event(type="who", nick=nick, ident=ident, host=host, realname=realname, target=channel, server=server, status=status)
self.event(type="who", nick=nick, ident=ident, host=host, realname=realname, channel=channel, server=server, status=status)
def irc_RPL_ENDOFWHO(self, prefix, params):
channel = params[1]
@@ -407,14 +407,14 @@ class IRCBot(IRCClient):
#log("Can no longer cover %s, removing records" % channel)# as it will only be matched once --
# other bots have different nicknames so
def left(self, user, channel, message): # even if they saw it, they wouldn't react
self.event(type="part", muser=user, target=channel, message=message)
self.event(type="part", muser=user, channel=channel, message=message)
self.botLeft(channel)
def userJoined(self, user, channel):
self.event(type="join", muser=user, target=channel)
self.event(type="join", muser=user, channel=channel)
def userLeft(self, user, channel, message):
self.event(type="part", muser=user, target=channel, message=message)
self.event(type="part", muser=user, channel=channel, message=message)
def userQuit(self, user, quitMessage):
self.chanlessEvent({"type": "quit", "muser": user, "message": quitMessage})
@@ -422,7 +422,7 @@ class IRCBot(IRCClient):
def userKicked(self, kickee, channel, kicker, message):
if kickee.lower() == self.nickname.lower():
self.botLeft(channel)
self.event(type="kick", muser=kicker, target=channel, message=message, user=kickee)
self.event(type="kick", muser=kicker, channel=channel, message=message, user=kickee)
def chanlessEvent(self, cast):
cast["nick"], cast["ident"], cast["host"] = self.parsen(cast["muser"])
@@ -437,20 +437,20 @@ class IRCBot(IRCClient):
# ones we have common with them
realChans = set(chans).intersection(set(self.channels))
for i in realChans:
cast["target"] = i
cast["channel"] = i
self.event(**cast)
def userRenamed(self, oldname, newname):
self.chanlessEvent({"type": "nick", "muser": oldname, "user": newname})
def topicUpdated(self, user, channel, newTopic):
self.event(type="topic", muser=user, target=channel, message= newTopic)
self.event(type="topic", muser=user, channel=channel, message= newTopic)
def modeChanged(self, user, channel, toset, modes, args):
argList = list(args)
modeList = [i for i in modes]
for a, m in zip(argList, modeList):
self.event(type="mode", muser=user, target=channel, modes=m, status=toset, modeargs=a)
self.event(type="mode", muser=user, channel=channel, modes=m, status=toset, modeargs=a)
class IRCBotFactory(ReconnectingClientFactory):
def __init__(self, net, num=None, relayCommands=None, user=None, stage2=None):