1
0

on_welcome.py 1.5 KB

12345678910111213141516171819202122232425262728
  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. print(self.xbot + ' LOGIN %s %s' % (self.network.nickname, self.network.password))
  14. connection.privmsg(self.xbot, 'LOGIN %s %s' % (self.network.nickname, self.network.password)) # Identify with X.
  15. connection.mode(connection.get_nickname(), "-x")
  16. do_everything_to.join(self, connection, self.network.home_channel) # Join home channel.
  17. # Join channels with the autojoin setting.
  18. channels = queries.get_autojoin_channels(self) # Get channels with autojoin setting.
  19. log.info('Joining autojoin channels: %s' % channels)
  20. for channel in channels:
  21. connection.join(channel) # Join channels with autojoin function.
  22. #connection.privmsg('NickServ', 'ACCESS LIST') # Request access list from NickServ.