summaryrefslogtreecommitdiff
path: root/megahal_bot.py
diff options
context:
space:
mode:
authoryvesf <yvesf@d0e8fea9-7529-0410-93fb-d39fd5b9c1dd>2009-06-10 08:32:42 +0000
committeryvesf <yvesf@d0e8fea9-7529-0410-93fb-d39fd5b9c1dd>2009-06-10 08:32:42 +0000
commit5515a3aefb0ae18b06780788af839ddebf1c8485 (patch)
treed38fc28a9726f49e371e6c624c96b4b466dbc5e1 /megahal_bot.py
parentc6bb1110cbe9b2a9e9b31c5fc66e1e5c7aa5deba (diff)
downloadomegle-5515a3aefb0ae18b06780788af839ddebf1c8485.tar.gz
omegle-5515a3aefb0ae18b06780788af839ddebf1c8485.zip
ibla
git-svn-id: http://xapek.org/svn/common/omegle@1099 d0e8fea9-7529-0410-93fb-d39fd5b9c1dd
Diffstat (limited to 'megahal_bot.py')
-rw-r--r--megahal_bot.py27
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)