Spaces:
Running
Running
# 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!"}}) | |