from common import log, queries, font

def process_event(self, connection, event):
    log.info(event) # Log to console.

    # Get and update resources.
    channel = queries.create_or_get_and_update_last_event(self, 'channel', 'ci', channel_name=event.arguments[0], user_name=event.source.nick)
    user = queries.create_or_get_and_update_last_event(self, 'user', 'ci', channel_name=event.arguments[0], user_name=event.source.nick)

    if event.target == connection.get_nickname(): # Bot invited.
        Inform.operators(self, connection, 'Received invitation to %s %s %s form %s %s %s.' % (font.red, event.arguments[0], font.reset, font.red, event.source.nick, font.reset))
        connection.privmsg(event.source.nick, 'Ask an operator of %s%s%s to make me join.' % (font.red, self.network.home_channel, font.reset))
        connection.invite(event.source.nick, self.network.home_channel)
