Use a dictionary for greetings, making it easier to change them
This commit is contained in:
parent
b987f3f381
commit
b4264e1018
1 changed files with 13 additions and 21 deletions
34
tweeter.py
34
tweeter.py
|
@ -28,28 +28,20 @@ while True:
|
|||
original = int(status[0])
|
||||
recipient = status[2]
|
||||
comment = status[3]
|
||||
try:
|
||||
greeting = random.randint(1,9)
|
||||
if greeting == 1:
|
||||
text = "Es ist soweit."
|
||||
elif greeting == 2:
|
||||
text = "Die Zeit ist gekommen."
|
||||
elif greeting == 3:
|
||||
text = "Los geht's."
|
||||
elif greeting == 4:
|
||||
text = "Du wolltest geweckt werden. Ich wecke."
|
||||
elif greeting == 5:
|
||||
text = "*aufweck*"
|
||||
elif greeting == 6:
|
||||
text = "Hopp, aufstehen!"
|
||||
elif greeting == 7:
|
||||
text = "*BUMM*"
|
||||
elif greeting == 8:
|
||||
text = "Guten Tag. Hier spricht die Polizei!"
|
||||
else:
|
||||
text = "Guten Morgen. :P"
|
||||
greetings = {
|
||||
0: "Es ist soweit."
|
||||
1: "Die Zeit ist gekommen."
|
||||
2: "Los geht's."
|
||||
3: "Du wolltest geweckt werden. Ich wecke."
|
||||
4: "*aufweck*"
|
||||
5: "Hopp, aufstehen!"
|
||||
6: "*BUMM*"
|
||||
7: "Guten Tag. Hier spricht die Polizei!"
|
||||
8: "Guten Morgen. :P"
|
||||
}
|
||||
|
||||
api.update_status("@%s %s %s" % (recipient, text, comment) [:140], original)
|
||||
try:
|
||||
api.update_status("@%s %s %s" % (recipient, greetings.get(random.randint(0,len(dict)-1)), comment) [:140], original)
|
||||
cur.execute("UPDATE tweets SET sent = 1 WHERE tweet_id = %i" % original)
|
||||
sql_conn.commit()
|
||||
except Exception, e:
|
||||
|
|
Loading…
Reference in a new issue