Alibrown commited on
Commit
71634bf
·
verified ·
1 Parent(s): 1ec4313

Create app/app.py

Browse files
Files changed (1) hide show
  1. app/app.py +26 -0
app/app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Flask, request, jsonify
2
+ import os
3
+
4
+ app = Flask(__name__)
5
+
6
+ @app.route("/interactions", methods=["POST"])
7
+ def interactions():
8
+ data = request.json
9
+
10
+ if data["type"] == 1:
11
+ return jsonify({"type": 1}) # Verifizierungs-Ping zurücksenden
12
+
13
+ if data["type"] == 2: # Anfrage auf Slash-Command (Typ 2)
14
+ command = data["data"]["name"]
15
+
16
+ if command == "settings":
17
+ return jsonify({
18
+ "type": 4,
19
+ "data": {
20
+ "content": "Hier sind die aktuellen Einstellungen deiner App."
21
+ }
22
+ })
23
+ return jsonify({})
24
+
25
+ if __name__ == "__main__":
26
+ app.run(host="0.0.0.0", port=int(os.getenv("PORT", 8080)))