From d7bdbaaa1659289be2b07a532f98058ecba32916 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 25 Apr 2014 12:06:50 +0200 Subject: add titlebot Reaktor configuration --- titlebot/commands/new | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 titlebot/commands/new (limited to 'titlebot/commands/new') diff --git a/titlebot/commands/new b/titlebot/commands/new new file mode 100755 index 0000000..7246a2b --- /dev/null +++ b/titlebot/commands/new @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 +import json +from os import environ +import sys +import os +# krebs polling +import poll + +f = 'suggestions.json' +title=" ".join(sys.argv[1:]) +db = poll.load_db(f) + +suggester = environ['_from'] +if not poll.title_in_db(title,db): + db.append( { 'by': suggester, + 'votes':{},'title': title}) + print("Thank you for your suggestion '%s'!"%environ["_from"]) + print("To vote type '.up %d'"%(len(db)-1)) +poll.save_db(f,db) -- cgit v1.2.3