discord-bot / app /app.py
Alibrown's picture
Update app/app.py
9ca9914 verified
raw
history blame
713 Bytes
from flask import Flask, request, jsonify
import os
app = Flask(__name__)
@app.route("/interactions", methods=["POST"])
def interactions():
data = request.json
# Discord Ping Verification
if data["type"] == 1:
return jsonify({"type": 1})
# Slash Command Handler
if data["type"] == 2:
command = data["data"]["name"]
if command == "settings":
return jsonify({
"type": 4,
"data": {
"content": "Hier sind die aktuellen Einstellungen deiner App."
}
})
return jsonify({})
if __name__ == "__main__":
app.run(host="0.0.0.0", port=int(os.getenv("PORT", 8080)))