Exemplo n.º 1
0
	def on_other(self, c, e):
		""" executed when an event without a specific on_<event>
		handler happens """
		if e.eventtype() != "all_raw_messages": # ignore these, because they
							# happen for every event
			#print "in on_other with eventtype:", e.eventtype()
			args = {}
			args["event"] = e
			args["type"] = e.eventtype()
			moolog.logevent(e)
			temp = threading.Thread(target=self.process_other, \
				args=(args, ""), name="other subthread")
			temp.setDaemon(1)
			temp.start()
Exemplo n.º 2
0
    def on_other(self, c, e):
        """ executed when an event without a specific on_<event>
		handler happens """
        if e.eventtype() != "all_raw_messages":  # ignore these, because they
            # happen for every event
            #print "in on_other with eventtype:", e.eventtype()
            args = {}
            args["event"] = e
            args["type"] = e.eventtype()
            moolog.logevent(e)
            temp = threading.Thread(target=self.process_other, \
             args=(args, ""), name="other subthread")
            temp.setDaemon(1)
            temp.start()
Exemplo n.º 3
0
	def on_pubmsg(self, c, e):
		"""Whenever someone speaks in a channel where our bot resides, this is
		executed"""
		msg = e.arguments()[0]
		args = {}
		args["text"] = msg
		args["type"] = e.eventtype()
		args["source"] = e.source()
		args["channel"] = e.target()
		args["encoding"] = self.connection.encoding
		args["event"] = e
		# Then check with all the global handlers, see if any match
		from irclib import nm_to_n
		# Debug(what was said to the stdout with a bit of colour.)
		# Debug(YELLOW + "<" + nm_to_n(args["source"]) + NORMAL + "/" +\
		# 	BLUE + args["channel"] + ">" + NORMAL +\
		# 	RED + "(" + args["type"] + ")" + NORMAL, args["text"])
		moolog.logevent(e)
		temp = threading.Thread(target=self.process_pubmsg, \
			args=(msg, args), name="pubmsg subthread")
		temp.setDaemon(1)
		temp.start()
Exemplo n.º 4
0
    def on_pubmsg(self, c, e):
        """Whenever someone speaks in a channel where our bot resides, this is
		executed"""
        msg = e.arguments()[0]
        args = {}
        args["text"] = msg
        args["type"] = e.eventtype()
        args["source"] = e.source()
        args["channel"] = e.target()
        args["encoding"] = self.connection.encoding
        args["event"] = e
        # Then check with all the global handlers, see if any match
        from irclib import nm_to_n
        # Debug(what was said to the stdout with a bit of colour.)
        # Debug(YELLOW + "<" + nm_to_n(args["source"]) + NORMAL + "/" +\
        # 	BLUE + args["channel"] + ">" + NORMAL +\
        # 	RED + "(" + args["type"] + ")" + NORMAL, args["text"])
        moolog.logevent(e)
        temp = threading.Thread(target=self.process_pubmsg, \
         args=(msg, args), name="pubmsg subthread")
        temp.setDaemon(1)
        temp.start()
Exemplo n.º 5
0
	def on_privmsg(self, c, e):
		"""Whenever someone sends a /msg to our bot, this is executed"""
		msg = e.arguments()[0]	# the string of what was said
		# build the args dict for the handlers
		args={}
		args["text"] = self.connection.get_nickname() + ": " + msg
		e._rawdata = self.connection.get_nickname().encode(self.connection.encoding) + ": " + e.rawdata()
		args["type"] = e.eventtype()
		args["source"] = e.source()
		args["channel"] = e.target()
		args["encoding"] = self.connection.encoding
		args["event"] = e
		msg = msg.strip()
		from irclib import nm_to_n
		# Debug(what was said to the stdout with a bit of colour.)
		# Debug(YELLOW + "<" + nm_to_n(args["source"]) + NORMAL + "/" + \
		# 	BLUE + args["channel"] + ">" + NORMAL + \
		# 	RED + "(" + args["type"] + ")" + NORMAL, args["text"])
		moolog.logevent(e)
		temp = threading.Thread(target=self.process_privmsg, \
			args=(msg, args), name="privmsg subthread")
		temp.setDaemon(1)
		temp.start()
Exemplo n.º 6
0
 def on_privmsg(self, c, e):
     """Whenever someone sends a /msg to our bot, this is executed"""
     msg = e.arguments()[0]  # the string of what was said
     # build the args dict for the handlers
     args = {}
     args["text"] = self.connection.get_nickname() + ": " + msg
     e._rawdata = self.connection.get_nickname().encode(
         self.connection.encoding) + ": " + e.rawdata()
     args["type"] = e.eventtype()
     args["source"] = e.source()
     args["channel"] = e.target()
     args["encoding"] = self.connection.encoding
     args["event"] = e
     msg = msg.strip()
     from irclib import nm_to_n
     # Debug(what was said to the stdout with a bit of colour.)
     # Debug(YELLOW + "<" + nm_to_n(args["source"]) + NORMAL + "/" + \
     # 	BLUE + args["channel"] + ">" + NORMAL + \
     # 	RED + "(" + args["type"] + ")" + NORMAL, args["text"])
     moolog.logevent(e)
     temp = threading.Thread(target=self.process_privmsg, \
      args=(msg, args), name="privmsg subthread")
     temp.setDaemon(1)
     temp.start()