diff options
-rw-r--r-- | megahal_bot.py | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/megahal_bot.py b/megahal_bot.py index 5bb686c..26f5d17 100644 --- a/megahal_bot.py +++ b/megahal_bot.py @@ -2,6 +2,7 @@ import logging from threading import Event import mh_python +import time import pyPgSQL.PgSQL from omegle import OmegleChat @@ -28,7 +29,7 @@ class MegahalBot(OmegleChat): print self.c("%s [MSG] %s: %s" %(time.strftime("%H:%M:%S"), self.name, r),bold=True) self.send(r) - def on_idle(self,partner): + def on_idle(self): self.idlecount += 1 if self.idlecount > 8: self.logger.info("Idle > 8. disconnect()") @@ -42,6 +43,7 @@ class MegahalBot(OmegleChat): def on_connect(self): print self.c("%s [EVT] %s Connection confirmed" % (time.strftime("%H:%M:%S"), self.name)) + self.send("Hi!") def on_disconnect(self): @@ -89,26 +91,3 @@ if __name__ == "__main__": if bot.is_connected: bot.disconnect() - - -mh_python.initbrain() -conn = pyPgSQL.PgSQL.connect("") - -cur = conn.cursor() -cur.execute("SELECT message FROM omegle_messages") -messages = cur.fetchall() -c=0 -for message in messages: - c+=1 - if c%20==0: - print "%s%s/%s" % ("\033[2K\033[E",c,len(messages)), - mh_python.learn(message[0]) - -print "" -cur.close() -conn.close() -import sys -while True: - print ">>> ", - x=sys.stdin.readline().strip() - print "<<< %s " % mh_python.doreply(x) |