summaryrefslogtreecommitdiffstats
path: root/Reaktor/titlebot/commands/new
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2014-04-25 12:06:50 +0200
committermakefu <github@syntax-fehler.de>2014-04-25 12:06:50 +0200
commit3907535dd48b94b3edd5facde0245719f04effb2 (patch)
treea25b7826c55cefe3be85f74b978bf0b9f2d19025 /Reaktor/titlebot/commands/new
parent9afc6e2d0237ae84c084cc05492bf0f285f98851 (diff)
add titlebot Reaktor configuration
Diffstat (limited to 'Reaktor/titlebot/commands/new')
-rwxr-xr-xReaktor/titlebot/commands/new19
1 files changed, 19 insertions, 0 deletions
diff --git a/Reaktor/titlebot/commands/new b/Reaktor/titlebot/commands/new
new file mode 100755
index 00000000..7246a2b2
--- /dev/null
+++ b/Reaktor/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)