diff options
author | yvesf <yvesf@d0e8fea9-7529-0410-93fb-d39fd5b9c1dd> | 2009-06-10 21:15:33 +0000 |
---|---|---|
committer | yvesf <yvesf@d0e8fea9-7529-0410-93fb-d39fd5b9c1dd> | 2009-06-10 21:15:33 +0000 |
commit | 8f3af268d4091fd6488a23480cbfdd9351046f42 (patch) | |
tree | abfbfa2fceb5996ad7821267b58966b27b007ea3 | |
parent | 13f7059823f35130dda74cfbe88e47ee9894e937 (diff) | |
download | omegle-8f3af268d4091fd6488a23480cbfdd9351046f42.tar.gz omegle-8f3af268d4091fd6488a23480cbfdd9351046f42.zip |
iblah
git-svn-id: http://xapek.org/svn/common/omegle@1107 d0e8fea9-7529-0410-93fb-d39fd5b9c1dd
-rw-r--r-- | megahal_bot.py | 49 | ||||
-rw-r--r-- | omegle.py | 10 | ||||
-rw-r--r-- | proxy.py | 4 |
3 files changed, 57 insertions, 6 deletions
diff --git a/megahal_bot.py b/megahal_bot.py index 9865df7..5055e45 100644 --- a/megahal_bot.py +++ b/megahal_bot.py @@ -30,7 +30,7 @@ class MegahalBot(OmegleChat): def respond(self,message): r=mh_python.doreply(message.encode("utf-8")) print self.c("%s [MSG] %s: %s" %(time.strftime("%H:%M:%S"), self.name, r),bold=True) - self.send(r.decode("utf-8")) + self.send(r) #.decode("utf-8")) def on_idle(self): self.idlecount += 1 @@ -40,9 +40,13 @@ class MegahalBot(OmegleChat): else: self.logger.info("Idle count %s/8" % self.idlecount) def on_message(self,message): - self.idlecount = 0 print self.c("%s [MSG] %s: %s" %(time.strftime("%H:%M:%S"), "Stranger", message),bold=True,color=32) - time.sleep(1) + self.idlecount = 0 + time.sleep(0.05) + print self.c("%s [EVT] %s: typing" %(time.strftime("%H:%M:%S"), self.name),bold=True,color=32), + self.typing() + time.sleep(1.5) + print "\033[E\033[2K", self.respond(message) def on_connect(self): @@ -60,7 +64,44 @@ if __name__ == "__main__": conn = pyPgSQL.PgSQL.connect("") cur = conn.cursor() - cur.execute("SELECT message FROM omegle_messages") +# sql = """SELECT message FROM omegle_messages +#WHERE LENGTH(message) < 15 +# OR CAST(RANDOM()*10 AS integer) < 6;""" #reduziert kurze sachen +# sql = """SELECT message FROM omegle_messages""" + + + #Offensive + sql = """SELECT message FROM omegle_messages + WHERE ( message ILIKE '%sex%' + OR message ILIKE '%boob%' + OR message ILIKE '%horny %' + OR message ILIKE '%pussy %' + OR message ILIKE '%ass %' + OR message ILIKE '%naked%' + OR message ILIKE '%fuck%' + OR LENGTH(message) < 7 AND CAST(RANDOM()*10 as integer)=1) + AND LENGTH(message) < 35 + AND NOT ( message ILIKE '%www%' + OR message ILIKE '%http%' + OR message ILIKE '%@%.%') + ; + """ + +# sql = """ +#SELECT message +# FROM omegle_messages +# WHERE from_ident IN ( +# SELECT from_ident +# FROM omegle_messages +# WHERE ( message ILIKE '%sex%' +# OR message ILIKE '%cam%' +# OR message ILIKE '%boobs%' +# OR message ILIKE '%horny%' +# OR message ILIKE '%pussy%' +# OR message ILIKE '%ass%') +# AND NOT ( message ILIKE '%www%' +# OR message ILIKE '%http%'));""" + cur.execute(sql) messages = cur.fetchall() c=0 for message in messages: @@ -125,9 +125,15 @@ class OmegleChat(RESTClient): """ #if a raw string given, assume its utf8 if msg.__class__ == str: - msg = msg.decode("utf8") + try: + msg = msg.decode("utf8") + except UnicodeDecodeError: + pass #convert utf8 to RAW-utf8 - msg = msg.encode("utf8") + try: + msg = msg.encode("utf8") + except UnicodeEncodeError,e: + self.logger.critical(e) if not self.is_confirmed: self.logger.error("Cant send message if not is_confirmed") @@ -16,6 +16,7 @@ class OmegleProxyChat(OmegleChat): self.name = name self.color = color self.idlecount = 0 + self.partner = None def c(self,str,bold=False): if bold: @@ -36,6 +37,7 @@ class OmegleProxyChat(OmegleChat): def on_message(self,message): self.idlecount = 0 + self.partner.idlecount = 0 print self.c("%s [MSG] %s: %s" %(time.strftime("%H:%M:%S"), self.name, message.encode("utf-8")),bold=True) if self.partner.is_connected: self.partner.send(message) @@ -44,6 +46,8 @@ class OmegleProxyChat(OmegleChat): print self.c("%s [EVT] %s Connection confirmed" % (time.strftime("%H:%M:%S"), self.name)) def on_typing(self): + self.idlecount = 0 + self.partner.idlecount = 0 print self.c("%s [EVT] %s is typing" % (time.strftime("%H:%M:%S"), self.name)) if self.partner.is_connected: self.partner.typing() |