#!/usr/bin/env python3


import pprint
import os
import lamper

from flask import Flask, request
from flask_api import status
app = Flask(__name__)

@app.route("/", methods=['POST', 'GET'])
def hello():
    # FIXME args/form
    if request.form.get('token') != os.environ['SLACK_TOKEN']:
        return "wrong token", status.HTTP_403_FORBIDDEN

    # FIXME args/form
    if request.form.get('channel_name') != os.environ['SLACK_CHANNEL']:
        return "wrong channel", status.HTTP_403_FORBIDDEN

    if request.form.get('text') not in lamper.colors.keys():
        return "wrong color" , status.HTTP_400_BAD_REQUEST

    lamper.set_dmx(lamper.colors[request.form.get('text')])

    return "Hello World! " + request.form.get('text')

@@ -196,37 +196,160 @@
 ello():%0A
+%0A
     
-# FIXME args/form
+pprint.pprint(request.form)%0A%0A    if request.form.get('command') != '/lamper':%0A        return %22wrong command%22 , status.HTTP_400_BAD_REQUEST%0A
 %0A    if 
@@ -367,20 +367,22 @@
 m.get('t
-oken
+eam_id
 ') != os
@@ -402,12 +402,13 @@
 CK_T
-OKEN
+EAMID
 '%5D:%0A
@@ -434,13 +434,16 @@
 ng t
-oken%22
+eam id%22 
 , st
@@ -475,25 +475,123 @@
     
-# FIXME args/form
+if request.form.get('token') != os.environ%5B'SLACK_TOKEN'%5D:%0A        return %22wrong token%22, status.HTTP_403_FORBIDDEN%0A
 %0A   
@@ -620,20 +620,18 @@
 channel_
-name
+id
 ') != os
@@ -653,16 +653,18 @@
 _CHANNEL
+ID
 '%5D:%0A    
@@ -688,16 +688,19 @@
  channel
+ id
 %22, statu

add more untested changes for slack integration