Use the network name instead of the numbered instance name for counting events

This commit is contained in:
Mark Veidemanis 2018-10-14 20:16:41 +01:00
parent c6e9604d6f
commit 3b42f19291
1 changed files with 16 additions and 16 deletions

View File

@ -77,7 +77,7 @@ class IRCBot(IRCClient):
def privmsg(self, user, channel, msg):
nick, ident, host = self.parsen(user)
userinfo.editUser(self.net, channel, nick, user)
count.event(self.name, "privmsg")
count.event(self.net, "privmsg")
keyword.actKeyword(user, channel, msg, self.nickname, "MSG", self.name)
monitor.event(self.net, channel, {"type": "msg", "exact": user, "nick": nick, "ident": ident, "host": host, "message": msg})
@ -85,7 +85,7 @@ class IRCBot(IRCClient):
def noticed(self, user, channel, msg):
nick, ident, host = self.parsen(user)
userinfo.editUser(self.net, channel, nick, user)
count.event(self.name, "notice")
count.event(self.net, "notice")
keyword.actKeyword(user, channel, msg, self.nickname, "NOTICE", self.name)
monitor.event(self.net, channel, {"type": "notice", "exact": user, "nick": nick, "ident": ident, "host": host, "message": msg})
@ -93,7 +93,7 @@ class IRCBot(IRCClient):
def action(self, user, channel, msg):
nick, ident, host = self.parsen(user)
userinfo.editUser(self.net, channel, nick, user)
count.event(self.name, "action")
count.event(self.net, "action")
keyword.actKeyword(user, channel, msg, self.nickname, "ACTION", self.name)
monitor.event(self.net, channel, {"type": "action", "exact": user, "nick": nick, "ident": ident, "host": host, "message": msg})
@ -118,7 +118,7 @@ class IRCBot(IRCClient):
oldnick, ident, host = self.parsen(olduser)
userinfo.renameUser(self.net, oldnick, olduser, newnick, newnick+"!"+ident+"@"+host)
self.nickname = newnick
count.event(self.name, "selfnick")
count.event(self.net, "selfnick")
def irc_ERR_NICKNAMEINUSE(self, prefix, params):
self._attemptedNick = self.alterCollidedNick(self._attemptedNick)
@ -148,7 +148,7 @@ class IRCBot(IRCClient):
return
n = self._who[channel][1]
n.append([nick, user, host, server, status, realname])
count.event(self.name, "whoreply")
count.event(self.net, "whoreply")
monitor.event(self.net, channel, {"type": "who", "exact": nick+"!"+user+"@"+host, "nick": nick, "ident": user, "host": host, "realname": realname, "server": server, "status": status})
def irc_RPL_ENDOFWHO(self, prefix, params):
@ -283,14 +283,14 @@ class IRCBot(IRCClient):
self.msg(self.authentity, "IDENTIFY %s" % self.nspass)
for i in self.autojoin:
self.join(i)
count.event(self.name, "signedon")
count.event(self.net, "signedon")
def joined(self, channel):
if not channel in self.channels:
self.channels.append(channel)
self.names(channel).addCallback(self.got_names)
self.who(channel).addCallback(self.got_who)
count.event(self.name, "selfjoin")
count.event(self.net, "selfjoin")
if self.name == main.config["Master"][0] and channel == main.config["Master"][1]:
for i in range(len(main.masterbuf)):
self.msg(channel, main.masterbuf.pop(0))
@ -313,7 +313,7 @@ class IRCBot(IRCClient):
def left(self, channel, message):
keyword.actKeyword(self.nickname, channel, message, self.nickname, "SELFPART", self.name)
count.event(self.name, "selfpart")
count.event(self.net, "selfpart")
monitor.event(self.net, channel, {"type": "part", "message": message})
self.botLeft(channel)
@ -322,27 +322,27 @@ class IRCBot(IRCClient):
if channel in self.channels:
self.channels.remove(channel)
keyword.sendMaster("KICK %s: (%s/%s) %s" % (self.name, kicker, channel, message))
count.event(self.name, "selfkick")
count.event(self.net, "selfkick")
monitor.event(self.net, channel, {"type": "kick", "exact": kicker, "nick": nick, "ident": ident, "host": host, "message": message})
self.botLeft(channel)
def userJoined(self, user, channel):
nick, ident, host = self.parsen(user)
userinfo.addUser(self.net, channel, nick, user)
count.event(self.name, "join")
count.event(self.net, "join")
monitor.event(self.net, channel, {"type": "join", "exact": user, "nick": nick, "ident": ident, "host": host})
def userLeft(self, user, channel, message):
nick, ident, host = self.parsen(user)
userinfo.delUser(self.net, channel, nick, user)
keyword.actKeyword(user, channel, message, self.nickname, "PART", self.name)
count.event(self.name, "part")
count.event(self.net, "part")
monitor.event(self.net, channel, {"type": "part", "exact": user, "nick": nick, "ident": ident, "host": host, "message": message})
def userQuit(self, user, quitMessage):
nick, ident, host = self.parsen(user)
userinfo.delUserByNetwork(self.net, nick, user)
count.event(self.name, "quit")
count.event(self.net, "quit")
keyword.actKeyword(user, None, quitMessage, self.nickname, "QUIT", self.name)
monitor.event(self.net, None, {"type": "quit", "exact": user, "nick": nick, "ident": ident, "host": host, "message": quitMessage})
@ -351,7 +351,7 @@ class IRCBot(IRCClient):
nick, ident, host = self.parsen(kicker)
userinfo.editUser(self.net, channel, nick, kicker)
userinfo.delUserByNick(self.net, channel, kickee)
count.event(self.name, "kick")
count.event(self.net, "kick")
keyword.actKeyword(kicker, channel, message, self.nickname, "KICK", self.name)
monitor.event(self.net, channel, {"type": "kick", "exact": kicker, "nick": nick, "ident": ident, "host": host, "message": message, "user": kickee})
@ -359,13 +359,13 @@ class IRCBot(IRCClient):
def userRenamed(self, oldname, newname):
nick, ident, host = self.parsen(oldname)
userinfo.renameUser(self.net, nick, oldname, newname, newname+"!"+ident+"@"+host)
count.event(self.name, "nick")
count.event(self.net, "nick")
monitor.event(self.net, None, {"type": "nick", "exact": oldname, "nick": nick, "ident": ident, "host": host, "user": newname})
def topicUpdated(self, user, channel, newTopic):
nick, ident, host = self.parsen(user)
userinfo.editUser(self.net, channel, nick, user)
count.event(self.name, "topic")
count.event(self.net, "topic")
keyword.actKeyword(user, channel, newTopic, self.nickname, "TOPIC", self.name)
monitor.event(self.net, channel, {"type": "topic", "exact": user, "nick": nick, "ident": ident, "host": host, "message": newTopic})
@ -373,7 +373,7 @@ class IRCBot(IRCClient):
def modeChanged(self, user, channel, toset, modes, args):
nick, ident, host = self.parsen(user)
userinfo.editUser(self.net, channel, nick, user)
count.event(self.name, "mode")
count.event(self.net, "mode")
argList = list(args)
modeList = [i for i in modes]
for a, m in zip(argList, modeList):