Alibrown commited on
Commit
faeb9b4
·
verified ·
1 Parent(s): adfb3b5

Update app/app.py

Browse files
Files changed (1) hide show
  1. app/app.py +5 -17
app/app.py CHANGED
@@ -7,12 +7,10 @@ from nacl.exceptions import BadSignatureError
7
  import threading
8
  import requests
9
  import time
 
10
 
11
  # Logging konfigurieren
12
- logging.basicConfig(
13
- level=logging.INFO,
14
- format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
15
- )
16
  logger = logging.getLogger(__name__)
17
 
18
  # Konfiguration
@@ -33,10 +31,8 @@ def verify_discord_request():
33
  try:
34
  signature = request.headers.get('X-Signature-Ed25519')
35
  timestamp = request.headers.get('X-Signature-Timestamp')
36
-
37
  if not signature or not timestamp:
38
  return False
39
-
40
  body = request.data.decode('utf-8')
41
  verify_key.verify(f"{timestamp}{body}".encode(), bytes.fromhex(signature))
42
  return True
@@ -68,24 +64,16 @@ def interactions():
68
 
69
  # Discord Ping Verification
70
  if data.get("type") == 1:
71
- logger.info("Responding to ping verification")
72
- return jsonify({"type": 1})
73
 
74
  # Slash Commands
75
  if data.get("type") == 2:
76
  command = data.get("data", {}).get("name")
77
- logger.info(f"Received command: {command}")
78
-
79
  if command == "settings":
80
- return jsonify({
81
- "type": 4,
82
- "data": {
83
- "content": "✅ Bot ist aktiv und verifiziert!"
84
- }
85
- })
86
 
87
  return jsonify({"type": 1})
88
-
89
  except Exception as e:
90
  logger.error(f"Error processing request: {str(e)}")
91
  return "Internal server error", 500
 
7
  import threading
8
  import requests
9
  import time
10
+ from commands import ping_command, settings_command
11
 
12
  # Logging konfigurieren
13
+ logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
 
 
 
14
  logger = logging.getLogger(__name__)
15
 
16
  # Konfiguration
 
31
  try:
32
  signature = request.headers.get('X-Signature-Ed25519')
33
  timestamp = request.headers.get('X-Signature-Timestamp')
 
34
  if not signature or not timestamp:
35
  return False
 
36
  body = request.data.decode('utf-8')
37
  verify_key.verify(f"{timestamp}{body}".encode(), bytes.fromhex(signature))
38
  return True
 
64
 
65
  # Discord Ping Verification
66
  if data.get("type") == 1:
67
+ return ping_command(data)
 
68
 
69
  # Slash Commands
70
  if data.get("type") == 2:
71
  command = data.get("data", {}).get("name")
 
 
72
  if command == "settings":
73
+ return settings_command(data)
 
 
 
 
 
74
 
75
  return jsonify({"type": 1})
76
+
77
  except Exception as e:
78
  logger.error(f"Error processing request: {str(e)}")
79
  return "Internal server error", 500