Ejemplo n.º 1
0
    def handle(self, event):
        if event.message_id == 353:
            self.bot.mem_store['nicklist'][event.channel] = event.line.split(
                ":")[2].split()

        if event.msg.startswith(".nicklist"):
            print(self.bot.mem_store['nicklist'][event.channel])

        if event._type == "__.nicklisting_other_join__":
            try:
                self.bot.mem_store['nicklist'][event.channel].append(
                    strip_nick(event.user))
            except KeyError:
                self.bot.mem_store['nicklist'][event.channel] = list()

        if event._type == "__.nicklisting_part__":
            try:
                self.bot.mem_store['nicklist'][event.channel].remove(
                    strip_nick(event.user))
            except ValueError:
                pass

        if event._type == "__.nicklisting_quit__":
            try:
                for name, chan in self.bot.mem_store['nicklist'].items():
                    chan.remove(strip_nick(event.user))
            except ValueError:
                pass
Ejemplo n.º 2
0
  def handle(self, event):
    if event.message_id == 353:
      self.bot.mem_store['nicklist'][event.channel] = event.line.split(":")[2].split()
    
    if event.msg.startswith(".nicklist"):
      print self.bot.mem_store['nicklist'][event.channel]

    if event._type == "__.nicklisting_other_join__":
      try:
        self.bot.mem_store['nicklist'][event.channel].append(strip_nick(event.user))
      except KeyError:
        self.bot.mem_store['nicklist'][event.channel] = list()

    if event._type == "__.nicklisting_part__":
      try:
        self.bot.mem_store['nicklist'][event.channel].remove(strip_nick(event.user))
      except ValueError:
        pass

    if event._type == "__.nicklisting_quit__":
      try:
        for name, chan in self.bot.mem_store['nicklist'].iteritems():
          chan.remove(strip_nick(event.user))
      except ValueError:
        pass
Ejemplo n.º 3
0
Archivo: seen.py Proyecto: hlmtre/pybot
  def handle(self, event):
    self.mem_store_init()

    if event.msg.startswith(".seen"):
      try:
        nick = strip_nick(event.msg.split()[1].lower()) # store all nicks in lowercase
      except IndexError:
        return
      if nick in (n.lower() for n in self.bot.mem_store['seen']):
        self.say(event.channel, "Last saw " + nick + " " + prettydate(self.bot.mem_store['seen'][nick]))
      else:
        self.say(event.channel, "haven't seen " + nick)

    self.bot.mem_store['seen'][strip_nick(event.user).lower()] = datetime.now()
Ejemplo n.º 4
0
    def handle(self, event):
        self.mem_store_init()

        if event.msg.startswith(".seen"):
            try:
                # store all nicks in lowercase
                nick = strip_nick(event.msg.split()[1].lower())
            except IndexError:
                return
            if nick in (n.lower() for n in self.bot.mem_store['seen']):
                self.say(
                    event.channel, "Last saw " + nick + " " +
                    prettydate(self.bot.mem_store['seen'][nick]))
            else:
                self.say(event.channel, "haven't seen " + nick)

        self.bot.mem_store['seen'][strip_nick(
            event.user).lower()] = datetime.now()