def on_nick(self, c, e): if self.config.getBoolean('irc.logging'): log.log(e) seen = database.session.query( database.Seen).filter_by(nick=e.source.nick).all() if seen: seen[0].time = datetime.datetime.now() seen[0].reason = 'nick' seen[0].args = e.target else: database.session.add( database.Seen(time=datetime.datetime.now(), nick=e.source.nick, reason='nick', args=e.target)) database.session.commit()
def on_kick(self, c, e): if self.config.getBoolean('irc.logging'): log.log(e) seen = database.session.query( database.Seen).filter_by(nick=e.arguments[0]).all() if seen: seen[0].time = datetime.datetime.now() seen[0].reason = 'kick' seen[0].args = e.source.nick + ' ' + e.arguments[1] else: database.session.add( database.Seen(time=datetime.datetime.now(), nick=e.arguments[0], reason='kick', args=e.source.nick + ' ' + e.arguments[1])) database.session.commit() if e.arguments[0] == c.get_nickname(): self.connection.join(self.channel)
def on_quit(self, c, e): if self.config.getBoolean('irc.logging'): log.log(e) seen = database.session.query( database.Seen).filter_by(nick=e.source.nick).all() if seen: seen[0].time = datetime.datetime.now() seen[0].reason = 'quit' seen[0].args = e.arguments[0] else: database.session.add( database.Seen(time=datetime.datetime.now(), nick=e.source.nick, reason='quit', args=e.arguments[0])) database.session.commit() if len(e.source.nick) < len(c.get_nickname()) and re.search( r'^' + c.get_nickname().rstrip('_') + r'_*$', e.source.nick): c.nick(e.source.nick)