diff options
Diffstat (limited to 'megahal_bot.py')
-rw-r--r-- | megahal_bot.py | 49 |
1 files changed, 45 insertions, 4 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: |