diff --git a/docs/source/changelog/index.rst b/docs/source/changelog/index.rst deleted file mode 100644 index cfbea3d..0000000 --- a/docs/source/changelog/index.rst +++ /dev/null @@ -1,3 +0,0 @@ -All Versions of ManagerX. -========================================= - diff --git a/docs/source/dev_guide/getting_start/installation.rst b/docs/source/dev_guide/getting_start/installation.rst deleted file mode 100644 index 955e5f1..0000000 --- a/docs/source/dev_guide/getting_start/installation.rst +++ /dev/null @@ -1,65 +0,0 @@ -Installation -============ - -A powerful Discord bot for server management and fun. - ----- - -Installation Methods --------------------- - -GitHub Installation (Recommended) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -**Get the latest version directly from the source:** - -.. code-block:: bash - - git clone https://github.com/ManagerX-Development/ManagerX - cd ManagerX - pip install . - -.. note:: - ✨ **Latest Version:** This method always provides the most current version with all the latest features and updates. - ----- - -PyPI Installation -~~~~~~~~~~~~~~~~~ - -Install via pip with different configurations: - -**Standard Installation:** - -.. code-block:: bash - - pip install managerx - -**With Developer Tools:** - -.. code-block:: bash - - pip install "managerx[dev]" - -**With Documentation Tools:** - -.. code-block:: bash - - pip install "managerx[docs]" - -**Full Installation (All Features):** - -.. code-block:: bash - - pip install "managerx[all]" - -.. warning:: - PyPI releases may not always contain the absolute latest version. For the most up-to-date code, use the GitHub installation method. - ----- - -Requirements ------------- - -* Python 3.8 or higher -* pip (Python package installer) \ No newline at end of file diff --git a/docs/source/dev_guide/index.rst b/docs/source/dev_guide/index.rst index 15e5eab..b80075d 100644 --- a/docs/source/dev_guide/index.rst +++ b/docs/source/dev_guide/index.rst @@ -1,20 +1,234 @@ -Developer Guide -======================== +=============================== +👨‍💻 Developer Guide +=============================== -Welcome to the ManagerX Developer Guide! +**Welcome to the ManagerX Developer Guide!** + +This comprehensive documentation is your resource for understanding ManagerX's architecture, extending the bot, deploying it to production, and contributing to the project. Whether you're building a new feature, self-hosting ManagerX, or simply curious about how it works, you'll find everything you need here. .. note:: - This project is permanently under development. We recommend checking this guide frequently for updates. + **New to ManagerX?** Start with :doc:`getting_started/index` to set up your development environment. + +.. important:: + This project is under active development. Features and APIs may change. Check back regularly for updates! + +--- + +🚀 Quick Start Paths +==================== + +**Want to get up and running immediately?** + +1. Install dependencies → :doc:`installation/index` +2. Understand the structure → :doc:`project_structure/index` +3. Learn the architecture → :doc:`architecture/index` +4. Start coding → :doc:`bot_development/index` + +**Deploying to production?** + +1. Review deployment options → :doc:`deployment/index` +2. Set up your server → :doc:`deployment/index` +3. Configure monitoring → :doc:`deployment/index` +4. Establish backups → :doc:`database/index` + +**Want to contribute?** + +1. Fork the repository +2. Read :doc:`contributing/index` +3. Create a feature branch +4. Follow code style → :doc:`contributing/index` +5. Write tests → :doc:`testing/index` +6. Submit a pull request! + +--- + +📚 Documentation Structure +=========================== + +**Getting Started** + +- :doc:`getting_started/index` — Installation, setup, first steps +- :doc:`installation/index` — Detailed installation instructions +- :doc:`project_structure/index` — Repository organization + +**Understanding ManagerX** + +- :doc:`architecture/index` — System design and components +- :doc:`database/index` — SQLite database schema and operations +- :doc:`bot_development/index` — Building bot features and cogs +- :doc:`api_development/index` — Creating API endpoints + +**Development** + +- :doc:`testing/index` — Unit tests, integration tests, testing strategy +- :doc:`deployment/index` — Production deployment, hosting options +- :doc:`contributing/index` — Contribution guidelines, PR process +- :doc:`troubleshooting/index` — Debugging and common issues + +--- + +🏗️ Architecture Overview +========================= + +ManagerX consists of three main components: + +**Bot Core (Python)** + +Discord.py/py-cord based bot with modular cog system. Handles Discord events, commands, and business logic. + +- Location: ``src/bot/`` +- Main entry: ``main.py`` + +**API Server (FastAPI)** + +REST API providing bot data to frontend and external services. + +- Location: ``src/api/`` +- Port: 8040 +- Runs in same process as bot + +**Web Dashboard (React)** + +Modern TypeScript/React frontend with real-time statistics and management interface. + +- Location: ``src/web/`` +- Port: 8080 +- Built with Vite + +See :doc:`architecture/index` for detailed architecture documentation. + +--- + +🛠️ Development Environment +============================ + +**Prerequisites:** + +- Python 3.11+ +- Node.js 18+ (for web development) +- Git +- SQLite3 (usually included with Python) + +**Quick Setup:** + +.. code-block:: bash + + # Clone repository + git clone https://github.com/ManagerX-Development/ManagerX.git + cd ManagerX + + # Create virtual environment + python -m venv .venv + source .venv/bin/activate # On Windows: .venv\\Scripts\\activate + + # Install dependencies + pip install -r requirements/bot_req.txt + + # Set up configuration + cp config/config.yaml config/config.local.yaml + # Edit config/config.local.yaml with your settings + + # Run the bot + python main.py + +For detailed setup, see :doc:`getting_started/index`. + +--- + +📖 Common Development Tasks +============================ + +**Creating a New Command** + +See :doc:`bot_development/index` for complete example + +**Adding a Database Table** + +See :doc:`database/index` for schema modifications + +**Creating an API Endpoint** + +See :doc:`api_development/index` for REST endpoint examples + +**Writing Tests** + +See :doc:`testing/index` for testing patterns + +**Deploying to Production** + +See :doc:`deployment/index` for deployment procedures + +--- + +🤝 Contributing +================ + +We welcome contributions! Whether it's bug fixes, new features, or documentation improvements: + +1. Fork the repository +2. Create a feature branch: ``git checkout -b feature/amazing-feature`` +3. Follow code style (see :doc:`contributing/index`) +4. Write or update tests (see :doc:`testing/index`) +5. Commit with clear messages (see :doc:`contributing/index`) +6. Push and create a Pull Request + +See :doc:`contributing/index` for complete contribution guidelines. + +--- + +📊 Project Statistics +====================== + +- **Language:** Python (bot) + TypeScript (web) +- **Framework:** discord.py + FastAPI + React +- **Database:** SQLite +- **Lines of Code:** 10,000+ +- **Cogs/Modules:** 10+ +- **API Endpoints:** 20+ +- **Commands:** 50+ + +--- + +🔗 Quick Navigation +==================== + +Key Sections: + +.. toctree:: + :maxdepth: 1 + :caption: Getting Started + :hidden: + + getting_started + installation + project_structure .. toctree:: - :maxdepth: 2 - :caption: Getting Started: + :maxdepth: 1 + :caption: Core Concepts + :hidden: + + architecture + design_patterns + database_design .. toctree:: - :maxdepth: 2 - :caption: Architecture: + :maxdepth: 1 + :caption: Development + :hidden: + + bot_development + api_development + frontend_development + testing .. toctree:: - :maxdepth: 2 - :caption: Contribution: - \ No newline at end of file + :maxdepth: 1 + :caption: Community + :hidden: + + contributing + code_style + deployment + + \ No newline at end of file diff --git a/docs/source/index.rst b/docs/source/index.rst index f28de32..1065705 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -1,101 +1,189 @@ -========================== -ManagerX Documentation -========================== +======================================== +🤖 ManagerX Documentation +======================================== -.. container:: mx-hero +**The Ultimate Discord Management Solution** - .. image:: https://img.shields.io/badge/Version-2.0.0-e11d48?style=for-the-badge - :alt: Version 2.0.0 +Powerful. Modular. Open Source. - .. image:: https://img.shields.io/badge/Python-3.8+-green.svg?style=for-the-badge - :alt: Python 3.8+ +.. image:: https://img.shields.io/badge/Version-2.0.0-e11d48?style=for-the-badge + :alt: Version 2.0.0 + :target: https://github.com/ManagerX-Development/ManagerX/releases - .. image:: https://img.shields.io/badge/License-GPL.3.0-yellow.svg?style=for-the-badge - :alt: GPL.3.0 License +.. image:: https://img.shields.io/badge/Python-3.11+-green.svg?style=for-the-badge + :alt: Python 3.11+ - **The Ultimate Discord Management Solution** - - ManagerX is a powerful, feature-rich Discord bot designed to help server administrators manage their communities with precision. From advanced moderation to engaging entertainment, ManagerX is your all-in-one tool. +.. image:: https://img.shields.io/badge/License-GPL--3.0-yellow.svg?style=for-the-badge + :alt: GPL-3.0 License + :target: https://github.com/ManagerX-Development/ManagerX/blob/main/LICENSE - `GitHub Repository `_ | `Report an Issue `_ +.. image:: https://img.shields.io/github/stars/ManagerX-Development/ManagerX?style=for-the-badge + :alt: GitHub Stars + :target: https://github.com/ManagerX-Development/ManagerX + +ManagerX is a comprehensive Discord bot designed for modern server management. With advanced moderation, engaging entertainment features, detailed statistics, and a beautiful web dashboard, ManagerX brings your Discord server to the next level. + +✨ **What Makes ManagerX Special:** + +- 🎯 **Intuitive Commands** — Easy-to-use slash commands for all features +- 🛡️ **Powerful Moderation** — Anti-spam, warnings, timeouts, and more +- 📊 **Live Dashboard** — Real-time server statistics and status +- 🎮 **Fun & Games** — Entertainment commands and interactive games +- ⚙️ **Fully Configurable** — Customize every aspect of the bot +- 🔧 **Developer-Friendly** — Well-documented API and extensible architecture +- 🌍 **Global Ready** — Multi-language support +- 📜 **Active Development** — Regularly updated with new features + +🚀 **Quick Start** + +1. **New User?** Start with :doc:`user_guide/quick_start/index` +2. **Want to Contribute?** Check out :doc:`dev_guide/getting_started/index` +3. **Need Help?** Visit :doc:`user_guide/faq/index` --- -.. container:: mx-grid-2 +📚 Documentation Sections +========================= + +**👥 User Guide** - .. container:: mx-card +Everything you need to know to use ManagerX on your server: - **📖 User Guide** - Learn how to invite ManagerX, set up your server, and master all available commands. - - `Open User Guide `_ +- Getting started and setup +- Command reference +- Feature overview +- Configuration options +- Troubleshooting - .. container:: mx-card +`→ Open User Guide `_ - **👨‍💻 Developer Guide** - Deep dive into the architecture, SQLite database schemas, and how to extend the bot. - - `Open Developer Guide `_ +**👨‍💻 Developer Guide** + +For developers who want to extend or self-host ManagerX: + +- Architecture overview +- Installation & setup +- Bot development +- API development +- Testing & deployment +- Contributing guidelines + +`→ Open Developer Guide `_ --- -Key Features ------------- +🌟 Core Features +================= -.. container:: mx-grid-2 +.. list-table:: + :class: feature-table + :widths: 20 80 + + * - **🛡️ Moderation** + - Anti-spam detection, warning system, user timeouts, kicks, bans, slowmode, votekick system, comprehensive logging + * - **🎮 Entertainment** + - Tic Tac Toe, Connect 4, Wikipedia search, jokes, weather information, interactive games + * - **📊 Statistics** + - User profiles with XP tracking, server statistics, leaderboards, achievement system, user activity monitoring + * - **⚙️ Management** + - Auto-roles on join, welcome/goodbye messages, channel management, global chat networks, configuration system + * - **📈 Insights** + - Server analytics, member insights, bot performance metrics, activity tracking + * - **🔌 Integration** + - REST API, web dashboard, real-time status updates, data export capabilities - .. container:: mx-box - - 🛡️ **Advanced Moderation** - Comprehensive anti-spam, warning systems, timeouts, and automated ban/kick functionality to keep your server safe. +--- - .. container:: mx-box - - 🎮 **Entertainment & Fun** - Integrated Wikipedia search, Jokes, Weather info, and classic games like Tic Tac Toe and Connect 4. +💡 How to Use This Documentation +================================= - .. container:: mx-box - - 📊 **Stats & Information** - Detailed server statistics, user profiles, bot status tracking, and a robust XP-based leveling system. +**For Server Owners & Moderators:** - .. container:: mx-box - - ⚙️ **Server Management** - Custom welcome messages, auto-delete filters, global chat networks, and temporary voice channels. +Start with :doc:`user_guide/quick_start/index` guide. You'll learn how to add ManagerX to your server, configure it, and use all available commands. -Detailed Feature Overview -------------------------- +**For Developers:** -.. list-table:: - :header-rows: 1 - :widths: 25 75 - :class: docutils - - * - Category - - Included Features - * - **Fun Commands** - - Wikipedia (search, random), Jokes, Tic Tac Toe, Connect 4, Weather - * - **Moderation** - - Anti-spam, Warnings, Timeouts, Kicks, Bans, Slowmode, Votekick - * - **Information** - - Bot Status, Server Info, User Management, Bot Statistics - * - **Server Management** - - Welcome Messages, Auto-delete, Global Chat, Level System, Logging, Temp VC - * - **Developer Tools** - - Dynamic Cog Loading, SQLite Databases, Async Handling, Comprehensive Logging +Head over to :doc:`dev_guide/getting_started/index` to set up a development environment. The :doc:`dev_guide/architecture/index` will help you understand how ManagerX is built. + +**For Contributors:** + +Read :doc:`dev_guide/contributing/index` for contribution guidelines, code style, and the pull request process. + +**For Self-Hosting:** + +Check out :doc:`dev_guide/deployment/index` for production deployment instructions. + +--- + +📖 Feature Categories +====================== + +🎯 **Frequently Used** + +- :doc:`user_guide/commands/index` — Complete command list +- :doc:`user_guide/setup_guide/index` — Server setup +- :doc:`user_guide/configuration/index` — Advanced configuration + +🔧 **Technical** + +- :doc:`dev_guide/architecture/index` — System design +- :doc:`dev_guide/database/index` — Database schema +- :doc:`dev_guide/api_development/index` — API endpoints + +❓ **Support** + +- :doc:`user_guide/faq/index` — Common questions +- :doc:`user_guide/troubleshooting/index` — Solving problems +- :doc:`dev_guide/troubleshooting/index` — Developer troubleshooting + +--- + +🆘 Getting Help +================ + +**Documentation Issues?** + +Found a typo or unclear section? `Report an issue `_ + +**Bug Report?** + +Create a detailed issue on `GitHub Issues `_ + +**Feature Request?** + +Suggest new features on GitHub or join our Discord community + +**Community Support?** + +Join our Discord server for real-time help and community discussion + +--- + +📋 Version Information +======================= + +- **Current Version:** 2.0.0 +- **Python Required:** 3.11 or higher +- **License:** GPL-3.0 +- **Last Updated:** January 2026 +- **Stability:** Production Ready + +--- Frequently Asked Questions --------------------------- +=========================== **Q: How do I invite ManagerX to my server?** - Visit the GitHub repository and follow the invitation link provided in the README. + +Check :doc:`user_guide/quick_start/index` for a complete invitation guide with screenshots. **Q: How do I report bugs or request features?** - Please open an issue on the `GitHub Issues page `_. + +Please open an issue on the `GitHub Issues page `_. Provide as much detail as possible. **Q: Can I self-host ManagerX?** - Yes! Detailed setup instructions for self-hosting can be found in the `Developer Guide `_. + +Yes! See :doc:`dev_guide/deployment/index` for complete self-hosting instructions with multiple hosting options. **Q: Which Python version is required?** ManagerX requires **Python 3.8** or higher to function correctly. diff --git a/docs/source/user_guide/index.rst b/docs/source/user_guide/index.rst new file mode 100644 index 0000000..8ecefb2 --- /dev/null +++ b/docs/source/user_guide/index.rst @@ -0,0 +1,230 @@ +======================= +👥 User Guide +======================= + +**Welcome to the ManagerX User Guide!** + +This documentation is designed for everyone who uses ManagerX on their Discord server. From server owners to moderators to regular members, you'll find guides for getting started, using commands, managing configurations, and troubleshooting issues. + +.. note:: + **New to ManagerX?** Start with :doc:`quick_start/index` guide for a step-by-step introduction. + +.. important:: + ManagerX is actively developed and regularly updated with new features. Check back frequently for documentation updates! + +--- + +🚀 Getting Started +=================== + +**First time using ManagerX?** Follow these steps: + +1. **Add the Bot** → :doc:`quick_start/index` (5 minutes) +2. **Set Up Your Server** → :doc:`setup_guide/index` (15 minutes) +3. **Learn the Features** → :doc:`features/index` +4. **Explore Commands** → :doc:`commands/index` + +That's it! ManagerX is ready to use. + +--- + +📚 Documentation Overview +========================== + +**Quick Start** + +- :doc:`quick_start/index` — Add ManagerX to your server in minutes +- Getting bot token +- Permissions setup +- Initial configuration + +**Features & Capabilities** + +- :doc:`features/index` — Overview of all ManagerX features +- Moderation tools +- Entertainment commands +- Statistics and profiles +- Server management + +**Commands & Usage** + +- :doc:`commands/index` — Complete command reference +- Slash command syntax +- Examples for each command +- Permission requirements + +**Configuration** + +- :doc:`setup_guide/index` — Detailed server setup guide +- Role configuration +- Channel setup +- Moderation settings +- XP system configuration + +- :doc:`configuration/index` — All configuration options +- Advanced settings +- Best practices +- Optimization tips + +**Help & Support** + +- :doc:`faq/index` — Frequently asked questions +- Common scenarios +- Quick answers + +- :doc:`troubleshooting/index` — Solving problems +- Bot not responding +- Permission issues +- Command errors +- Performance problems + +--- + +🎯 Feature Categories +====================== + +ManagerX is organized into these main categories: + +**🛡️ Moderation** + +Keep your server safe and organized: + +- Anti-spam detection +- Warning system +- User timeouts and mutes +- Kick and ban functions +- Comprehensive action logging +- Slowmode management + +See :doc:`commands/index` for moderation command reference. + +**🎮 Entertainment & Fun** + +Keep members engaged with games and fun commands: + +- Tic Tac Toe game +- Connect 4 game +- Wikipedia search and facts +- Jokes and memes +- Weather information +- Interactive interactions + +See :doc:`features/index` for entertainment features. + +**📊 Statistics & Profiles** + +Track and display member activity: + +- User profiles with XP +- Server statistics +- Member leaderboards +- Message tracking +- Achievement system +- Activity reports + +See :doc:`commands/index` for stats commands. + +**⚙️ Server Management** + +Customize and control your server: + +- Auto-role assignment +- Welcome/goodbye messages +- Channel management +- Prefix configuration +- Global chat networks +- Logging channels + +See :doc:`setup_guide/index` for setup instructions. + +**📈 Dashboard** + +View real-time server statistics and status: + +- Live bot status +- Server member count +- Bot latency +- Uptime tracking +- Database status + +Access at: ``http://your-domain/status`` + +--- + +💡 Quick Reference +==================== + +**Most Popular Commands** + +- ``/stats`` — View your profile and statistics +- ``/warn @user reason`` — Warn a user +- ``/serverinfo`` — Display server information +- ``/profile`` — Your personal profile +- ``/leaderboard`` — Top members by XP + +See :doc:`commands/index` for the complete command list. + +**Common Tasks** + +- **Add bot to server** → :doc:`quick_start/index` +- **Set up moderation** → :doc:`setup_guide/index` +- **Configure roles** → :doc:`setup_guide/index` +- **Change settings** → :doc:`configuration/index` +- **Enable features** → :doc:`features/index` +- **Troubleshoot issues** → :doc:`troubleshooting/index` + +--- + +🆘 Need Help? +=============== + +**My Question Isn't Answered** + +1. Search the documentation using the search bar +2. Check :doc:`faq/index` for common questions +3. Review :doc:`troubleshooting/index` for problems + +**Found a Bug?** + +Report it on `GitHub Issues `_ with: + +- Exact error message +- Steps to reproduce +- Your ManagerX version +- Bot and Discord version + +**Need Immediate Help?** + +- Join our Discord community +- Ask in #support channel +- Community members are usually quick to help! + +**Feature Request?** + +Suggest new features on GitHub or in our Discord community! + +--- + +✨ Pro Tips +============ + +✅ **Use slash commands** — They're faster and more user-friendly than prefix commands + +✅ **Configure permissions** — Control who can use which commands + +✅ **Set up logging** — Track moderation actions in a dedicated channel + +✅ **Enable auto-roles** — Automatically assign roles to new members + +✅ **Customize welcome messages** — Greet new members with a personal touch + +✅ **Monitor the dashboard** — Check server statistics anytime + +✅ **Read announcements** — Stay updated with new features + +--- + +📋 Navigation Guide +==================== + +Use these sections to find what you need: diff --git a/main.py b/main.py index fc67086..05a36d5 100644 --- a/main.py +++ b/main.py @@ -13,11 +13,14 @@ import sys import asyncio from pathlib import Path +from datetime import datetime from colorama import Fore, Style, init as colorama_init from dotenv import load_dotenv import ezcord from ezcord import CogLog -from aiohttp import web # Neu für die Status-Seite +from fastapi import FastAPI +from fastapi.middleware.cors import CORSMiddleware +from uvicorn import Server, Config # Logger (muss existieren!) from logger import logger @@ -30,6 +33,9 @@ from src.bot.core.dashboard import DashboardTask from src.bot.core.utils import print_logo +# API Routes für Dashboard +from src.api.dashboard.routes import set_bot_instance, router as dashboard_router + # ============================================================================= # SETUP # ============================================================================= @@ -42,38 +48,32 @@ sys.path.append(str(BASEDIR)) # ============================================================================= -# STATUS API SERVER (Für die React-Webseite) +# FASTAPI SETUP # ============================================================================= -async def get_status_api(request): - """Liefert Live-Daten an die React Status-Seite""" - try: - status_data = { - "status": "online", - "latency": f"{round(bot.latency * 1000)}ms", - "version": BotConfig.VERSION, - "guilds": len(bot.guilds), - "users": len(bot.users), - "sqlite": "connected", - "ai_engine": "ready" - } - return web.json_response(status_data, headers={ - "Access-Control-Allow-Origin": "*", - "Access-Control-Allow-Methods": "GET" - }) - except Exception as e: - logger.error("API", f"Fehler bei Status-Abfrage: {e}") - return web.json_response({"status": "error"}, status=500) +app = FastAPI( + title="ManagerX Dashboard API", + description="Live Bot Status & Statistiken API", + version=BotConfig.VERSION +) + +# CORS aktivieren +app.add_middleware( + CORSMiddleware, + allow_origins=["*"], + allow_credentials=True, + allow_methods=["*"], + allow_headers=["*"], +) + +# Dashboard-Routes einbinden +app.include_router(dashboard_router) async def start_webserver(): - """Startet den aiohttp Webserver auf Port 8080""" - app = web.Application() - app.router.add_get('/api/status', get_status_api) - runner = web.AppRunner(app) - await runner.setup() - # Port 8080 - Stelle sicher, dass dieser in der Firewall offen ist (ufw allow 8080/tcp) - site = web.TCPSite(runner, '0.0.0.0', 8040) - await site.start() - logger.success("API", "Status-Server läuft auf http://0.0.0.0:8040/api/status") + """Startet den FastAPI Webserver auf Port 8040""" + config = Config(app=app, host="0.0.0.0", port=8040, log_level="error") + server = Server(config) + await server.serve() + logger.success("API", "FastAPI-Server läuft auf http://0.0.0.0:8040") # ============================================================================= # MAIN EXECUTION @@ -93,6 +93,13 @@ async def start_webserver(): bot_setup = BotSetup(config) bot = bot_setup.create_bot() + # Speichere Bot Start-Zeit für Uptime-Berechnung + bot.start_time = datetime.utcnow() + + # Übergebe Bot-Instanz an die API-Routes + set_bot_instance(bot) + logger.info("API", "Bot-Instanz an Dashboard-API übergeben") + # Datenbank initialisieren db_manager = DatabaseManager() if not db_manager.initialize(bot): diff --git a/public/img/avatar.png b/public/img/avatar.png new file mode 100644 index 0000000..950a896 Binary files /dev/null and b/public/img/avatar.png differ diff --git a/src/api/dashboard/routes.py b/src/api/dashboard/routes.py new file mode 100644 index 0000000..03edf98 --- /dev/null +++ b/src/api/dashboard/routes.py @@ -0,0 +1,62 @@ +from fastapi import APIRouter, Request, HTTPException +from typing import List, Optional +from datetime import datetime +import time +# Falls du Schemas nutzt: from .schemas import ServerStatus, UserInfo + +# Wir erstellen einen Router, den wir später in die Haupt-App einbinden +router = APIRouter( + prefix="/api/v1/managerx", + tags=["dashboard"] +) + +# Global Bot-Referenz (wird später in main.py gesetzt) +bot_instance = None + +def set_bot_instance(bot): + """ + Setzt die globale Bot-Instanz für die API. + Diese Funktion wird aus main.py aufgerufen. + + Args: + bot: Die discord.py Bot-Instanz + """ + global bot_instance + bot_instance = bot + + +@router.get("/stats", response_model=dict) +async def get_stats(request: Request): + """ + Endpoint to get the current server status with real bot data. + + Returns: + dict: Server status mit echten Bot-Daten + """ + if bot_instance is None: + raise HTTPException(status_code=503, detail="Bot-Verbindung nicht verfügbar") + + try: + # Berechne Uptime (in Sekunden seit dem letzten Ready-Event) + uptime_seconds = (datetime.utcnow() - bot_instance.start_time).total_seconds() if hasattr(bot_instance, 'start_time') else 0 + uptime_minutes, remainder = divmod(int(uptime_seconds), 60) + uptime_hours, uptime_minutes = divmod(uptime_minutes, 60) + uptime_days, uptime_hours = divmod(uptime_hours, 24) + + uptime_str = f"{int(uptime_days)}d {int(uptime_hours)}h {int(uptime_minutes)}m" + + # Sammle echte Daten vom Bot + server_status = { + "uptime": uptime_str, + "latency": f"{round(bot_instance.latency * 1000)}ms", + "guilds": len(bot_instance.guilds), + "users": len(bot_instance.users), + "bot_name": bot_instance.user.name if bot_instance.user else "Unknown", + "bot_id": bot_instance.user.id if bot_instance.user else None, + "status": "online" if bot_instance.latency != float('inf') else "offline", + "database": "connected" if hasattr(bot_instance, 'settings_db') and bot_instance.settings_db else "disconnected" + } + return server_status + except Exception as e: + raise HTTPException(status_code=500, detail=str(e)) + \ No newline at end of file diff --git a/src/bot/ui/emojis.yaml b/src/bot/ui/emojis.yaml new file mode 100644 index 0000000..e69de29 diff --git a/src/bot/ui/standards.yaml b/src/bot/ui/standards.yaml new file mode 100644 index 0000000..31a9d3b --- /dev/null +++ b/src/bot/ui/standards.yaml @@ -0,0 +1,7 @@ +standards: + footer: + name: "A Project of ManagerX Development." + name_with_webpage: "A Project of ManagerX Development ¦ https://managerx.oppro-network.de/" + + authors: + name: "ManagerX Development" \ No newline at end of file diff --git a/src/web/App.css b/src/web/App.css index b9d355d..51ae0fd 100644 --- a/src/web/App.css +++ b/src/web/App.css @@ -1,42 +1,54 @@ #root { - max-width: 1280px; - margin: 0 auto; - padding: 2rem; - text-align: center; + min-height: 100vh; } -.logo { - height: 6em; - padding: 1.5em; - will-change: filter; - transition: filter 300ms; -} -.logo:hover { - filter: drop-shadow(0 0 2em #646cffaa); -} -.logo.react:hover { - filter: drop-shadow(0 0 2em #61dafbaa); +/* Smooth Page Transitions */ +@keyframes pageEnter { + from { + opacity: 0; + transform: translateY(12px); + } + to { + opacity: 1; + transform: translateY(0); + } } -@keyframes logo-spin { +@keyframes pageFade { from { - transform: rotate(0deg); + opacity: 0; } to { - transform: rotate(360deg); + opacity: 1; } } -@media (prefers-reduced-motion: no-preference) { - a:nth-of-type(2) .logo { - animation: logo-spin infinite 20s linear; +/* Drift Animation for background */ +@keyframes drift { + 0% { + transform: translate(0, 0); } + 50% { + transform: translate(20px, -20px); + } + 100% { + transform: translate(0, 0); + } +} + +/* Animation delay utility */ +.animation-delay-2 { + animation-delay: 2s; +} + +.page-enter { + animation: pageEnter 0.6s cubic-bezier(0.4, 0, 0.2, 1); } -.card { - padding: 2em; +.page-fade { + animation: pageFade 0.5s cubic-bezier(0.4, 0, 0.2, 1); } -.read-the-docs { - color: #888; +.animate-drift { + animation: drift 20s linear infinite; } diff --git a/src/web/App.tsx b/src/web/App.tsx index 3d85de9..4374e76 100644 --- a/src/web/App.tsx +++ b/src/web/App.tsx @@ -1,8 +1,6 @@ -import { Toaster } from "@/components/ui/toaster"; -import { Toaster as Sonner } from "@/components/ui/sonner"; -import { TooltipProvider } from "@/components/ui/tooltip"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; -import { BrowserRouter, Routes, Route } from "react-router-dom"; +import { BrowserRouter, Routes, Route, useLocation } from "react-router-dom"; +import { motion, AnimatePresence } from "framer-motion"; import Index from "./pages/Index"; import NotFound from "./pages/NotFound"; import Impressum from "./pages/Impressum"; @@ -10,28 +8,45 @@ import Datenschutz from "./pages/Datenschutz"; import Nutzungsbedingungen from "./pages/Nutzungsbedingungen"; import PluginsPage from "./pages/PluginsPage"; import Status from "./pages/Status"; - +import { License } from "./pages/License"; const queryClient = new QueryClient(); -const App = () => ( - - - - - - +const AppContent = () => { + const location = useLocation(); + + return ( + + + } /> } /> } /> } /> + } /> } /> } /> - {/* ADD ALL CUSTOM ROUTES ABOVE THE CATCH-ALL "*" ROUTE */} } /> - - + + + ); +}; + +const App = () => ( + + + + ); diff --git a/src/web/components/CTA.tsx b/src/web/components/CTA.tsx index aca8ddb..f11b04f 100644 --- a/src/web/components/CTA.tsx +++ b/src/web/components/CTA.tsx @@ -12,57 +12,105 @@ const stats = [ export const CTA = memo(function CTA() { return (
- {/* Simple Background */} -
+ {/* Premium Background */} +
+
+
-
- - 100% Kostenlos -
+ + + 100% Kostenlos & Open Source + -

+ Bereit für das - nächste - Level - ? -

+ nächste Level + ? + -

- Füge ManagerX jetzt zu deinem Server hinzu und erlebe die Zukunft - der Discord Server-Verwaltung. -

+ + Füge ManagerX jetzt zu deinem Server hinzu und erlebe die moderne Discord Server-Verwaltung mit 90 innovativen Slash-Commands. + - +
+ {/* Bottom Stats */} -
- {stats.map((stat) => ( -
-
{stat.value}
-
{stat.label}
-
+ + {stats.map((stat, idx) => ( + +
+ {stat.value} +
+
+ {stat.label} +
+
))} -
+
diff --git a/src/web/components/FAQ.tsx b/src/web/components/FAQ.tsx index f0a2b0e..7811366 100644 --- a/src/web/components/FAQ.tsx +++ b/src/web/components/FAQ.tsx @@ -41,9 +41,11 @@ const faqs = [ export const FAQ = memo(function FAQ() { return ( -
- {/* Background Decor */} -
+
+ {/* Premium Background */} +
+
+
{/* Section Header */} @@ -51,21 +53,39 @@ export const FAQ = memo(function FAQ() { initial={{ opacity: 0, y: 20 }} whileInView={{ opacity: 1, y: 0 }} viewport={{ once: true }} - className="text-center mb-16" + transition={{ duration: 0.7, ease: "easeInOut" }} + className="text-center mb-20" > -
+ V2.0.0 • 90 Commands • GPL-3.0 -
+ -

+ Häufige Fragen -

-

- Alles Wissenswerte über die Open-Source-Entwicklung, das Self-Hosting und die neue V2-Architektur von ManagerX. -

+ + + Alles Wissenswerte über die Open-Source-Entwicklung, das Self-Hosting und die neue V2-Architektur. + {/* FAQ Accordion */} @@ -73,9 +93,10 @@ export const FAQ = memo(function FAQ() { initial={{ opacity: 0, y: 20 }} whileInView={{ opacity: 1, y: 0 }} viewport={{ once: true }} + transition={{ duration: 0.6 }} className="max-w-3xl mx-auto" > - + {faqs.map((faq, index) => ( {/* Header */} -
-
- -
+
+ + +
-

+ {title} -

+ -
    +
    {features.map((feature, index) => ( -
  • -
    - -
    - {feature} -
  • + + + + {feature} + ))} -
+
); }); diff --git a/src/web/components/Features.tsx b/src/web/components/Features.tsx index da08024..456a729 100644 --- a/src/web/components/Features.tsx +++ b/src/web/components/Features.tsx @@ -67,8 +67,10 @@ const featureCategories = [ export const Features = memo(function Features() { return (
- {/* Simple Background */} -
+ {/* Premium Background */} +
+
+
{/* Section Header */} @@ -76,21 +78,39 @@ export const Features = memo(function Features() { initial={{ opacity: 0, y: 20 }} whileInView={{ opacity: 1, y: 0 }} viewport={{ once: true }} - transition={{ duration: 0.4 }} - className="text-center max-w-3xl mx-auto mb-20" + transition={{ duration: 0.7, ease: "easeInOut" }} + className="text-center max-w-3xl mx-auto mb-24" > -
- - Über 90 Befehle -
+ + + Über 90 innovative Befehle + -

- Alles was du - brauchst -

-

- Ein Bot für alle deine Server-Bedürfnisse. Moderation, Engagement, Social Features und mehr. -

+ + Alles, was du + wirklich brauchst + + + Ein Bot für alle deine Server-Bedürfnisse. Moderation, Engagement, Social Features und interaktive Tools. + {/* Feature Cards Grid */} diff --git a/src/web/components/Footer.tsx b/src/web/components/Footer.tsx index 40e1af3..96f6022 100644 --- a/src/web/components/Footer.tsx +++ b/src/web/components/Footer.tsx @@ -1,7 +1,7 @@ import { memo } from "react"; import { Link } from "react-router-dom"; import { motion } from "framer-motion"; -import { Shield, Heart, Github, MessageCircle, ExternalLink, Terminal, Sparkles, Code2 } from "lucide-react"; +import { Shield, Heart, Github, MessageCircle, ExternalLink, Terminal, Sparkles, Code2, Zap, Users, Rocket, Star, BarChart3, Lock, Info, FileCheck, Activity } from "lucide-react"; const socialLinks = [ { icon: Github, href: "https://github.com/ManagerX-Development/ManagerX", label: "GitHub" }, @@ -10,10 +10,12 @@ const socialLinks = [ export const Footer = memo(function Footer() { return ( -