part.py 650 B

1234567891011121314151617181920212223
  1. class Part:
  2. def __init__(self, events=None, printer_handle=None, bot=None, say=None):
  3. self.events = events
  4. self.printer = printer_handle
  5. self.interests = ['__.part__']
  6. self.bot = bot
  7. self.cmd = None
  8. self.help = None
  9. for event in events:
  10. if event._type in self.interests:
  11. event.subscribe(self)
  12. def handle(self, event):
  13. try:
  14. if self.bot.conf.getOwner(self.bot.network) == event.line.split()[0].split("!",1)[0].replace(":","") and event.line.split()[2] == self.bot.conf.getNick(self.bot.network):
  15. self.bot.send("PART " + event.line.split()[4] + '\n')
  16. except:
  17. pass