File size: 1,507 Bytes
e5659d2
adfb3b5
 
197c89d
 
adfb3b5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197c89d
adfb3b5
17a5d0a
 
 
 
 
adfb3b5
 
 
 
 
 
 
 
 
 
 
 
 
 
197c89d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Globale Commands
from flask import jsonify
import logging
import datetime
import random

logger = logging.getLogger(__name__)

def ping_command(data):
    """Handles the '/ping' command"""
    if data.get("type") == 1:
        logger.info("Responding to ping verification")
        return jsonify({"type": 1})

def settings_command(data):
    """Handles the '/settings' command"""
    if data.get("type") == 2:
        command = data.get("data", {}).get("name")
        logger.info(f"Received command: {command}")
        return jsonify({
            "type": 4,
            "data": {
                "content": "✅ Bot ist aktiv und verifiziert!"
            }
        })

# Der Shop
def shop_command(user_id, item):
    """Shop command for buying items like avatars, roles, etc."""
    items = {
        "avatar1": 1000,
        "avatar2": 1500,        
        "avatar3": 15000,
        "role1": 2000000,
        "exclusive_channel_access": 300000000
    }
    
    if item not in items:
        return jsonify({"type": 4, "data": {"content": "Ungültiger Artikel!"}})
    
    item_price = items[item]
    user_data = get_user_data(user_id)
    
    if user_data['credits'] < item_price:
        return jsonify({"type": 4, "data": {"content": "Nicht genug Credits für diesen Artikel!"}})
    
    update_user_data(user_id, {'credits': user_data['credits'] - item_price})
    unlock_item(user_id, item)
    
    return jsonify({"type": 4, "data": {"content": f"Du hast erfolgreich {item} gekauft!"}})