diff options
author | makefu <github@syntax-fehler.de> | 2014-04-25 12:06:50 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2014-04-25 12:06:50 +0200 |
commit | d7bdbaaa1659289be2b07a532f98058ecba32916 (patch) | |
tree | 4edc9a3122af6aad33fe82e57805e0a9e75ba689 /titlebot/commands/up | |
parent | 09bc409155e99b04cb2282faa01548a40a2c135a (diff) |
add titlebot Reaktor configuration
Diffstat (limited to 'titlebot/commands/up')
-rwxr-xr-x | titlebot/commands/up | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/titlebot/commands/up b/titlebot/commands/up new file mode 100755 index 0000000..c9de122 --- /dev/null +++ b/titlebot/commands/up @@ -0,0 +1,27 @@ +#!/usr/bin/env python3 +import json +from os import environ +import sys +import os +# krebs polling +import poll + +f = 'suggestions.json' +db = poll.load_db(f) +votes = [] +try: + votes = sys.argv[1:] +except: + print("""usage: up number (...) + upvotes one or more entries based on .list""") + sys.exit(1) + +voter = environ['_prefix'] +for vote in votes: + try: + vote = int(vote) + db[vote]['votes'][voter] = 1 + except: + print("voting for #%s failed" %vote) +print("Thanks for your votes %s"%environ['_from']) +poll.save_db(f,db) |