diff options
Diffstat (limited to 'esperas.py')
-rw-r--r-- | esperas.py | 51 |
1 files changed, 31 insertions, 20 deletions
@@ -14,19 +14,19 @@ from libRLP import * HOST="irc.freenode.net" PORT=6667 -NICK="nekomimi" -IDENT="iloveiwikiwi:)" +NICK="GeneralFAQ" +IDENT="esperas" REALNAME="esperas" OWNER="iwikiwi" -CHANNEL = "#testesperas" +CHANNEL = "#sugar-autohelp" buffer = "" clientsock=socket.socket() clientsock.connect((HOST, PORT)) clientsock.send("NICK %s\r\n" % NICK) clientsock.send("USER %s %s bla :%s\r\n" % (IDENT, HOST, REALNAME)) clientsock.send("JOIN %s\r\n" % (CHANNEL)) -clientsock.send("PRIVMSG "+CHANNEL+" : *blush*.\r\n") -kitallis='kitallis' +#clientsock.send("PRIVMSG "+CHANNEL+" : *blush*.\r\n") +kitallis='111111111111111111111111111' kitallis1='' counter = 0 kitallisconf='' @@ -45,7 +45,7 @@ def parsemsg(msg): global storage global faqmode storage = anydbm.open('ircuserinfo','c') - kitallis='kitallis' + kitallis='111111111111111111111111111113333333333333' complete=msg[1:].split(':',1) #Parse the message into useful data print complete info=complete[0].split(' ') @@ -78,26 +78,37 @@ def parsemsg(msg): - print sender - if faqmode == 1: - process = InputBreaker(cmd[1]) - matchobj = Match(process.qEntitySentences) - answer = matchobj.reportAnswer() - clientsock.send("PRIVMSG "+CHANNEL+' :' + answer) - - else: - if cmd[1].find(' is') < 15 and cmd[1].find(' is') > 1 : - clientsock.send("PRIVMSG "+CHANNEL+' :'+ random.choice(['understood :)','okie!','right'])+ '\r\n') - lol=cmd[1] - key = lol.split(' is') - storage[key[0]]=cmd[1] - + if cmd[0] == NICK+":": + if faqmode == 1: + process = InputBreaker(cmd[1]) + matchobj = Match(process.qEntitySentences) + answer = matchobj.reportAnswer().split('A. ')[1] + answer = answer.replace("\n", "") + print answer + if len(answer) > 500: + answers = [answer[i:i+400] for i in range(0, len(answer), 400)] + + clientsock.send("PRIVMSG "+CHANNEL+' :' +sender[0]+', '+ answer[0:400]+ '\r\n') + del answers[0] + for answer in answers: + clientsock.send("PRIVMSG "+CHANNEL+' :'+ answer+ '\r\n') + time.sleep(1) + else: + clientsock.send("PRIVMSG "+CHANNEL+' :' +sender[0]+', '+answer+ '\r\n') + + elif cmd[1] == 'mode faq\r\n': print 'lol' faqmode = 1 + elif cmd[1].find(' is') < 15 and cmd[1].find(' is') > 1 : + clientsock.send("PRIVMSG "+CHANNEL+' :'+ random.choice(['understood :)','okie!','right'])+ '\r\n') + lol=cmd[1] + key = lol.split(' is') + storage[key[0]]=cmd[1] elif cmd[1] == 'say hello to all\r\n': clientsock.send("PRIVMSG "+CHANNEL+' :' + random.choice([' hello everyone!!! '])+ '\r\n') + elif cmd[1].find('say hello to')!=-1: name=cmd[1].split(' to',1) clientsock.send("PRIVMSG "+CHANNEL+' :' + random.choice(['hello, '])+ name[1].rstrip()+'!!'+ '\r\n') |