on_welcome.py 1.4 KB

123456789101112131415161718192021222324252627
  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. self.xbot = 'x@xhannels.%s' % '.'.join(event.source.split('.')[-2:])
  12. if self.network.password: # Password saved.
  13. connection.privmsg(self.xbot, 'LOGIN %s %s' % (self.networkself.nickname, self.network.password)) # Identify with X.
  14. connection.mode(connection.get_nickname(), "-x")
  15. do_everything_to.join(self, connection, self.network.home_channel) # Join home channel.
  16. # Join channels with the autojoin setting.
  17. channels = queries.get_autojoin_channels(self) # Get channels with autojoin setting.
  18. log.info('Joining autojoin channels: %s' % channels)
  19. for channel in channels:
  20. connection.join(channel) # Join channels with autojoin function.
  21. #connection.privmsg('NickServ', 'ACCESS LIST') # Request access list from NickServ.