Commit 3211407d authored by flynn's avatar flynn

mooooore

parent 9b3a842f
......@@ -22,29 +22,48 @@ def requires_token(token_name):
return decorator
"""
app_1 | {'channel_id': '8dgd5uzuq7gbbff6qy6t631qzw',
app_1 | 'channel_name': '357qk94hgtgxjd6a7fty8n3jha__bjsx9gnigf8e3mpuehgt8pkamo',
app_1 | 'command': '/troll_add_point',
app_1 | 'response_url': 'https://mattermost.zeus.gent/hooks/commands/z63r59zkrpyidqpcweh8kfc17r',
app_1 | 'team_domain': 'zeus',
app_1 | 'team_id': 'pbix1kziz7be3ntjoguf9c3cay',
app_1 | 'text': '@flynn',
app_1 | 'trigger_id': 'NXU5OHNkbmdldG5kOWZlbWZlcmd6OXFrNXk6MzU3cWs5NGhndGd4amQ2YTdmdHk4bjNqaGE6MTYwNTQwMzYwMTEyMTpNRVFDSUNwdFZYbk9ta2hORFhEdmFVRExIUnFRYVUvK3ZFTGZtN25IeUNIVG40R0hBaUIvcUZldytSVC9BSUs2Ukw5SU5BVlVuOC9zS3JUN0dlMnh5bFBadU8vc3FRPT0=',
app_1 | 'user_id': '357qk94hgtgxjd6a7fty8n3jha',
app_1 | 'user_mentions': 'flynn',
app_1 | 'user_mentions_ids': 'bjsx9gnigf8e3mpuehgt8pkamo',
app_1 | 'user_name': 'hannes'}
"""
@app.route("/troll_add_point", methods=["POST"])
@requires_token('troll_add_point')
def change():
# Get the channel, the user and the victim
channel = request.form['channel_id']
channel_name = request.form["channel_name"]
caller = request.form['user_id']
caller_name = request.form['user_name']
def handle_change(amount: int):
caller = request.form['user_name']
# victim_name = request.form['user'].strip()
if caller == "flynn" or caller == "hannes":
pprint(request.form)
print("test")
users = request.form['user_mentions']
print(users)
print("Change score for ^ with ")
print(amount)
if caller == "flynn" or caller == "hannes":
print("Received data")
return "", 200
return ""
else:
return "NO", 403
return "NO >:("
@app.route("/troll_add_point", methods=["POST"])
@requires_token('troll_add_point')
def add():
handle_change(1)
@requires_token('troll_remove_point')
@app.route("/troll_remove_point", methods=["POST"])
def remove():
handle_change(-1)
@app.route('/troll_list_points', methods=["GET"])
@requires_token('troll_list_points')
def list_points():
return "", 204
return ""
......@@ -2,6 +2,6 @@
tokens = {
'troll_add_point': 'abc',
'trol_remove_point': 'def',
'troll_remove_point': 'def',
'troll_list_points': 'ghi'
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment