summaryrefslogtreecommitdiff
path: root/megahal_bot.py
diff options
context:
space:
mode:
Diffstat (limited to 'megahal_bot.py')
-rw-r--r--megahal_bot.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/megahal_bot.py b/megahal_bot.py
index 9008db8..428ca6c 100644
--- a/megahal_bot.py
+++ b/megahal_bot.py
@@ -88,6 +88,8 @@ Argumente:
--host=HOST (Standard: HOST=omegle.com)
-d DBNAME or
--dbname=DBNAME Database (Standard: DBNAME=omegle)
+ --user=USER
+ --password=PASSWORD
-l or
--local Do local testing
-p NAME or
@@ -96,7 +98,7 @@ Argumente:
#parse args
try:
- opts, args = getopt.getopt(sys.argv[1:], "hp:d:l", ["help", "host=", "profile=","dbname=","local"])
+ opts, args = getopt.getopt(sys.argv[1:], "hp:d:l", ["help", "host=", "profile=","dbname=","local","user=","password="])
except getopt.GetoptError,err:
print str(err)
usage()
@@ -112,7 +114,7 @@ Argumente:
OR message ILIKE '%http%'
OR message ILIKE '%@%.%')
;""",
- "all":"""SELECT message FROM omegle_messages""",
+ "all":"""SELECT message FROM omegle_messages WHERE LENGTH(message) > 2 AND LENGTH(message) < 35""",
"offensive":
"""SELECT message FROM omegle_messages
WHERE ( message ILIKE '%sex%'
@@ -163,13 +165,18 @@ Argumente:
}
sqlKey = "standard"
dbname = "omegle"
-
+ user = "omegle"
+ password = "omegle"
for o, a in opts:
if o in ('-h', '--help'):
usage()
sys.exit(0)
elif o in ('-d', '--dbname'):
dbname = a
+ elif o in ('--user'):
+ user = a
+ elif o in ('--password'):
+ password = a
elif o in ('-l', '--local'):
local = True
elif o == "--host":
@@ -183,7 +190,7 @@ Argumente:
mh_python.initbrain()
- conn = pyPgSQL.PgSQL.connect(database=dbname,user="yvesf",password="iii",host="10.2.2.13")
+ conn = pyPgSQL.PgSQL.connect(database=dbname,user=user,password=password,host="10.2.2.13")
cur = conn.cursor()
print sql[sqlKey]
@@ -203,7 +210,7 @@ Argumente:
conn.close()
del messages
- logging.basicConfig(level=logging.ERROR)
+ logging.basicConfig(level=logging.DEBUG)
if local:
print "CTRL-C\n>>> ",
while True: