Ejemplo n.º 1
0
    def on_pubmsg(self, c, e):
        #print e.arguments()[0]
        global lastUpdated
        if file_get_contents('hook.txt') != lastUpdated:
            lastUpdated = file_get_contents('hook.txt')
            system('git pull')
            out = self.prolog.communicate("['hedgehogbot.pl'].")
            print 'Git updated! Reloaded prolog scripts...'
            print out

        a = e.arguments()[0].split(":", 1)
        if len(a) > 1 and irc_lower(a[0]) == irc_lower(
                self.connection.get_nickname()):
            self.do_command(c, e, a[1].strip())
        elif e.arguments()[0][:3] == "!pl":
            if nm_to_n(e.source()).lower() in self.admins:
                self.eval_command(c, e, e.arguments()[0][3:])
        elif e.arguments()[0][:4] == "!say":
            c.privmsg(self.channel, e.arguments()[0][5:])
        elif e.arguments()[0].startswith("!restart"):
            if nm_to_n(e.source()).lower() in self.admins:
                #c.privmsg("Restarting prolog side...")
                print "Restarting prolog side..."
                self.prolog.restart()
        elif e.arguments()[0][:5] == "!fact":
            fact = "assert(fact(" + e.arguments()[0][6:] + ")). remember."
            self.eval_command(c, e, fact)
        elif "om" in e.arguments()[0] and "nom" in e.arguments()[0]:
            c.privmsg(self.channel, simpl.omnom())
        return
Ejemplo n.º 2
0
    def on_pubmsg(self, c, e):
	#print e.arguments()[0]
	global lastUpdated
	if file_get_contents('hook.txt') != lastUpdated:
		lastUpdated = file_get_contents('hook.txt')
		system('git pull')
		out = self.prolog.communicate("['hedgehogbot.pl'].")
		print 'Git updated! Reloaded prolog scripts...'
		print out

        a = e.arguments()[0].split(":", 1)
        if len(a) > 1 and irc_lower(a[0]) == irc_lower(self.connection.get_nickname()):
            self.do_command(c, e, a[1].strip())
        elif e.arguments()[0][:3] == "!pl":
	    if nm_to_n(e.source()).lower() in self.admins:
		    self.eval_command(c, e, e.arguments()[0][3:])
	elif e.arguments()[0][:4] == "!say":
	    c.privmsg(self.channel, e.arguments()[0][5:])
	elif e.arguments()[0].startswith("!restart"):
	    if nm_to_n(e.source()).lower() in self.admins:
		    #c.privmsg("Restarting prolog side...")
	            print "Restarting prolog side..."
		    self.prolog.restart()
	elif e.arguments()[0][:5] == "!fact":
	    fact = "assert(fact("+e.arguments()[0][6:]+")). remember."
	    self.eval_command(c, e, fact)
	elif "om" in e.arguments()[0] and "nom" in e.arguments()[0]:
		c.privmsg(self.channel, simpl.omnom())
        return
Ejemplo n.º 3
0
 def on_pubmsg(self, c, e):
     a = e.arguments()[0].split(":", 1)
     if len(a) > 1 and irc_lower(a[0]) == irc_lower(self.connection.get_nickname()):
         self.do_command(e, a[1].strip())
     return
Ejemplo n.º 4
0
 def on_pubmsg(self, c, e):
     a = e.arguments()[0].split(":", 1)
     if len(a) > 1 and irc_lower(a[0]) == irc_lower(
             self.connection.get_nickname()):
         self.do_command(e, a[1].strip())
     return