diff options
Diffstat (limited to 'megahal_bot.py')
-rw-r--r-- | megahal_bot.py | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/megahal_bot.py b/megahal_bot.py index f1f3864..8f92961 100644 --- a/megahal_bot.py +++ b/megahal_bot.py @@ -29,7 +29,7 @@ class MegahalBot(OmegleChat): def respond(self,message,prepend=""): r=mh_python.doreply(message.encode("utf-8")) - print self.c("%s%s [MSG] %s: %s" %(prepend,time.strftime("%H:%M:%S"), self.name, r),bold=True) + print self.c("%s [MSG] %s: %s" %(time.strftime("%H:%M:%S"), self.name, r),bold=True) try: self.send(r) #.decode("utf-8")) except Exception,e: @@ -44,16 +44,18 @@ class MegahalBot(OmegleChat): self.disconnect_event.set() else: self.logger.info("Idle count %s/8" % self.idlecount) - self.respond("hey?") #restart the conv. + if self.is_confirmed: + self.respond("hey?") #restart the conv. def on_message(self,message): - print self.c("%s%s [MSG] %s: %s" %( - "\033[1A\033[2K\033[30D", + self.logger.info("Stranger: %s" % message) + print self.c("%s [MSG] %s: %s" %( time.strftime("%H:%M:%S"), "Stranger", message),bold=True,color=32) self.idlecount = 0 time.sleep(0.05) - typestr = "%s [EVT] %s: typing" %(time.strftime("%H:%M:%S"),self.name) - print self.c(typestr,bold=True,color=32) + self.logger.info("Megahal simulate typing") +# typestr = "%s [EVT] %s: typing" %(time.strftime("%H:%M:%S"),self.name) + #print self.c(typestr,bold=True,color=32) try: self.typing() except Exception,e: @@ -63,7 +65,7 @@ class MegahalBot(OmegleChat): self.disconnect_event.set() return time.sleep(random.randint(2,5)) - self.respond(message,prepend="\033[1A\033[2K\033[%sD"%(len(typestr))) #move up 1; delete line; move left %s + self.respond(message) #prepend="\033[1A\033[2K\033[%sD"%(len(typestr))) #move up 1; delete line; move left %s def on_connect(self): print self.c("%s [EVT] %s Connection confirmed" % (time.strftime("%H:%M:%S"), self.name)) @@ -105,11 +107,12 @@ Argumente: host = "omegle.com" sql = {"standard": """SELECT message FROM omegle_messages - WHERE LENGTH(message) < 35 + WHERE LENGTH(message) < 50 AND NOT ( message ILIKE '%www.%' OR message ILIKE '%http%' OR message ILIKE '%@%.%') ;""", + "all":"""SELECT message FROM omegle_messages""", "offensive": """SELECT message FROM omegle_messages WHERE ( message ILIKE '%sex%' @@ -127,8 +130,9 @@ Argumente: OR message ILIKE '%http%' OR message ILIKE '%@%.%');""", "offensive-large": - """SELECT message FROM omegle_messages WHERE from_ident in ( - SELECT from_ident FROM omegle_messages + """ + SELECT message FROM omegle_messages WHERE from_ident in ( + SELECT DISTINCT from_ident FROM omegle_messages WHERE ( message ILIKE '%sex%' OR message ILIKE '%boob%' OR message ILIKE '%horny %' @@ -173,7 +177,6 @@ Argumente: elif o in ("-p", "--profile"): if sql.has_key(a): sqlKey = a - print sql[a] else: print "Profile %s does not exist, create it!" % a sys.exit(0) @@ -183,6 +186,7 @@ Argumente: conn = pyPgSQL.PgSQL.connect(database=dbname) cur = conn.cursor() + print sql[sqlKey] cur.execute(sql[sqlKey]) messages = cur.fetchall() c=0 |