on_welcome.py 1.3 KB

1234567891011121314151617181920212223242526
  1. from common import log, do_everything_to, queries
  2. def process_event(self, connection, event):
  3. log.info(event) # Log event.
  4. self.db.run("UPDATE rotbot_host SET connection_succeeds = connection_succeeds + 1 WHERE id=%s", [self.network.id])
  5. # Identify with network services.
  6. network_services = queries.get_network_services(self)
  7. if network_services == 'm': # Modern network services (NickServ, ChanServ & MemoServ)
  8. if self.network.password: # Password saved.
  9. connection.privmsg("NickServ", "identify " + self.network.password) # Identify with NickServ.
  10. if network_services == 'x': # X bot.
  11. if self.network.password: # Password saved.
  12. connection.privmsg('x@channels.abovenet.org', 'LOGIN %s %s' % (self.networkself.nickname, self.network.password)) # Identify with X.
  13. connection.mode(connection.get_nickname(), "+x")
  14. do_everything_to.join(self, connection, self.network.home_channel) # Join home channel.
  15. # Join channels with the autojoin setting.
  16. channels = queries.get_autojoin_channels(self) # Get channels with autojoin setting.
  17. log.info('Joining autojoin channels: %s' % channels)
  18. for channel in channels:
  19. connection.join(channel) # Join channels with autojoin function.
  20. connection.privmsg('NickServ', 'ACCESS LIST') # Request access list from NickServ.