diff --git a/README.md b/README.md index 8fa30be..4bd68d8 100644 --- a/README.md +++ b/README.md @@ -88,7 +88,7 @@ ManagerX basiert auf einem modernen und erweiterbaren Tech-Stack: - **Core**: Python 3.10+ & [Pycord](https://pycord.dev) - **Framework**: [Ezcord](https://github.com/ezcord-dev/ezcord) für schnelles Cog-Management - **UI Components**: Discord Container & DesignerView (v2) -- **Database**: SQLite3 mit optimierter Index-Struktur +- **Database**: MariaDB (MxMariaDB) für hohe Skalierbarkeit und Performance - **API/Dashboard**: FastAPI & React/Vite (TailwindCSS)
diff --git a/docs/source/dev_guide/architecture.rst b/docs/source/dev_guide/architecture.rst new file mode 100644 index 0000000..131f60a --- /dev/null +++ b/docs/source/dev_guide/architecture.rst @@ -0,0 +1,43 @@ +========================== +🏗️ System Architecture +========================== + +ManagerX is built with a modern, decoupled architecture to ensure scalability and ease of development. + +1. High-Level Overview +====================== + +The system consists of three main components: + +- **Discord Bot (The Core):** Written in Python using `py-cord`. It handles all interactions with Discord servers, manages the local/MariaDB database, and executes commands. +- **REST API (The Bridge):** A FastAPI server integrated directly into the bot process. It provides live data (Uptime, Stats, Guild settings) to the web dashboard. +- **Web Dashboard (The Interface):** A React-based Single Page Application (SPA) that communicates with the API to provide a visual configuration interface. + +2. Component Breakdown +====================== + +Bot Core +-------- +- **Cogs (Plugins):** Features are modularly organized in ``src/bot/cogs``. This allows for easy hot-reloading and independent development of features. +- **Database Layer:** Supports both SQLite (for local dev) and MariaDB (for production). +- **EzCord:** A framework wrapper that simplifies UI components (Embeds, Buttons) and provides automatic logging. + +API (FastAPI) +------------- +- **Real-time Data:** Uses the bot's internal loop to fetch live shard status and server metrics. +- **Authentication:** Uses Discord OAuth2 to verify user identity and permissions. + +Frontend (React) +---------------- +- **Framework:** Vite for fast builds and HMR. +- **Styling:** Tailwind CSS with a "Glassmorphism" design system. +- **Components:** Radix UI for accessible primitives and Framer Motion for smooth animations. + +3. Execution Flow +================= + +1. **User Action:** A user clicks "Save" on the Dashboard. +2. **Frontend:** Sends a POST request to the API with the new configuration. +3. **API:** Validates the authentication token and role permissions. +4. **Bot:** Updates the internal database and applies changes (e.g., updating a welcome message or clearing the warning list). +5. **Discord:** The next time a member joins, the bot retrieves the updated data from the database and executes the new logic. diff --git a/docs/source/dev_guide/index.rst b/docs/source/dev_guide/index.rst index 45f0325..f7982bd 100644 --- a/docs/source/dev_guide/index.rst +++ b/docs/source/dev_guide/index.rst @@ -1,12 +1,24 @@ -Welcome to the Developer Guide for ManagerX. -========================================================== - -learn about the API, the Dashboard, the Bot and more. - -.. toctree:: - :maxdepth: 2 - :caption: API: - - Getting Started - Public Endpoints - \ No newline at end of file +=========================== +👨‍💻 Developer Guide +=========================== + +Welcome to the development section of ManagerX. This guide is intended for developers who want to self-host the bot, extend its functionality, or contribute to the core codebase. + +.. toctree:: + :maxdepth: 2 + :caption: Content: + + architecture + installation + api/index + contributing/index + +--- + +💡 Core Technology Stack +======================== + +- **Backend:** Python 3.11+ using `py-cord` and `ezcord`. +- **API:** FastAPI with Uvicorn. +- **Frontend:** React + TypeScript + Vite + Tailwind CSS. +- **Database:** MariaDB (Recommended) or SQLite. \ No newline at end of file diff --git a/docs/source/dev_guide/installation.rst b/docs/source/dev_guide/installation.rst new file mode 100644 index 0000000..2c2c795 --- /dev/null +++ b/docs/source/dev_guide/installation.rst @@ -0,0 +1,79 @@ +========================= +💻 Installation Guide +========================= + +This guide explains how to set up a self-hosted instance of ManagerX. + +Prerequisites +============= + +- **Python:** 3.11 or higher. +- **Node.js:** v18 or higher (for the frontend). +- **Database:** MariaDB (Recommended) or SQLite. +- **Discord Developer Account:** To create your bot application. + +1. Clone the Repository +======================= + +.. code-block:: bash + + git clone https://github.com/ManagerX-Development/ManagerX.git + cd ManagerX + +2. Backend Setup +================ + +1. Create a virtual environment: + + .. code-block:: bash + + python -m venv .venv + source .venv/bin/activate # Windows: .venv\Scripts\activate + +2. Install dependencies: + + .. code-block:: bash + + pip install -r requirements/base.txt + +3. Configure environment variables: + Copy ``config/.env.example`` to ``config/.env`` and fill in your: + - ``TOKEN`` (Discord Bot Token) + - ``DB_TYPE`` (mariadb or sqlite) + - ``DB_HOST``, ``DB_USER``, etc. + +3. Frontend Setup +================= + +1. Install Node dependencies: + + .. code-block:: bash + + npm install + +2. Build the production bundle: + + .. code-block:: bash + + npm run build + +4. Starting the Bot +=================== + +Run the main entry point: + +.. code-block:: bash + + python main.py + +The bot will start, and the FastAPI webserver for the dashboard will run on the configured port (default: 8000). + +--- + +🚀 Production Deployment +======================== + +For production, we recommend using: +- **PM2** or **Systemd** to keep the bot process alive. +- **Nginx** or **Traefik** as a reverse proxy for the API and static frontend files. +- **MariaDB** for reliable data storage. diff --git a/docs/source/index.rst b/docs/source/index.rst index 9e59556..28e92c7 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -1,193 +1,202 @@ -======================================== -🤖 ManagerX Documentation -======================================== - -**The Ultimate Discord Management Solution** - -Powerful. Modular. Open Source. - -.. 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/Python-3.11+-green.svg?style=for-the-badge - :alt: Python 3.11+ - -.. 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 - -.. 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` - ---- - -📚 Documentation Sections -========================= - -**👥 User Guide** - -Everything you need to know to use ManagerX on your server: - -- Getting started and setup -- Command reference -- Feature overview -- Configuration options -- Troubleshooting - -`→ Open User 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 `_ - ---- - -🌟 Core Features -================= - -.. 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 - ---- - -💡 How to Use This Documentation -================================= - -**For Server Owners & Moderators:** - -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. - -**For Developers:** - -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 -====================== - - - ---- - -🆘 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?** - -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 `_. Provide as much detail as possible. - -**Q: Can I self-host ManagerX?** - -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. - -Contributing ------------- - -We welcome contributions from the community! Whether it's bug reports, feature requests, or code improvements, feel free to get involved via our `GitHub Repository `_. For more details, check the **Contributing** section in the Developer Guide. - ---- - -**© 2026 ManagerX Development** -*Version 2.0.0-dev | Last Updated: December 7, 2025* - -.. toctree:: - :maxdepth: 2 - :caption: User Guide: - - user_guide/index - :maxdepth: 2 - :caption: Developer Guide: - - Developer Guide \ No newline at end of file +======================================== +🤖 ManagerX Documentation +======================================== + +**The Ultimate Discord Management Solution** + +Powerful. Modular. Open Source. + +.. 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/Python-3.11+-green.svg?style=for-the-badge + :alt: Python 3.11+ + +.. 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 + +.. 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` + +--- + +📚 Documentation Sections +========================= + +**👥 User Guide** + +Everything you need to know to use ManagerX on your server: + +- Getting started and setup +- Command reference +- Feature overview +- Configuration options +- Troubleshooting + +`→ Open User 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 `_ + +--- + +🌟 Core Features +================= + +.. 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 + +--- + +💡 How to Use This Documentation +================================= + +**For Server Owners & Moderators:** + +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. + +**For Developers:** + +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 +====================== + + + +--- + +🆘 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?** + +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 `_. Provide as much detail as possible. + +**Q: Can I self-host ManagerX?** + +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. + +Contributing +------------ + +We welcome contributions from the community! Whether it's bug reports, feature requests, or code improvements, feel free to get involved via our `GitHub Repository `_. For more details, check the **Contributing** section in the Developer Guide. + +--- + +**© 2026 ManagerX Development** +*Version 2.0.0-dev | Last Updated: December 7, 2025* + +.. toctree:: + :maxdepth: 2 + :caption: 👥 User Guide: + + user_guide/index + user_guide/getting_started + user_guide/moderation + user_guide/levels + user_guide/management + user_guide/dashboard + +.. toctree:: + :maxdepth: 2 + :caption: 👨‍💻 Developer Guide: + + dev_guide/index + dev_guide/architecture + dev_guide/installation \ No newline at end of file diff --git a/docs/source/user_guide/dashboard.rst b/docs/source/user_guide/dashboard.rst new file mode 100644 index 0000000..695b90c --- /dev/null +++ b/docs/source/user_guide/dashboard.rst @@ -0,0 +1,39 @@ +======================= +🖥️ Web Dashboard +======================= + +The ManagerX Web Dashboard is your central control panel for everything bot-related. It provides a sleek, modern interface to manage your server without typing complex commands. + +1. Access & Login +================= + +Visit `dashboard.managerx-bot.de `_ and log in via your Discord account. We only request basic identification and the "Guilds" permission to show you the servers you own. + +2. Server Selection +=================== + +On the main page, you will see all servers where you have **Manage Server** permissions. + +- **Manage:** If ManagerX is already on the server, click this to enter the settings. +- **Invite:** If the bot is missing, use this button to add it. + +3. Module Management +==================== + +The dashboard is divided into several modules: + +- **Sidebar:** Navigate between Overview, General Settings, and detailed feature tabs. +- **Save Changes:** Most changes are applied in real-time, but some "Global" settings require hitting the "Save" button at the bottom of the page. + +4. Advanced Features +==================== + +- **Stats Overview:** View live graphs of your server's growth and activity. +- **Permissions Bridge:** The dashboard respects your Discord role hierarchy. Only members with the "ManagerX Team Role" (configurable) can access sensitive server settings. +- **Responsive Design:** You can manage your server just as easily from your mobile phone as from your desktop. + +💡 Common Issues +================ + +- **Server not showing?** Make sure you have the "Manage Server" permission and try logging out and back in. +- **Settings not saving?** Ensure the bot has the "Administrator" permission or high enough roles to modify the requested settings. diff --git a/docs/source/user_guide/getting_started.rst b/docs/source/user_guide/getting_started.rst new file mode 100644 index 0000000..ef9b1f1 --- /dev/null +++ b/docs/source/user_guide/getting_started.rst @@ -0,0 +1,54 @@ +======================= +🚀 Getting Started +======================= + +Setting up ManagerX is designed to be as simple as possible. Follow this guide to get your bot up and running in minutes. + +1. Invite the Bot +================ + +First, you need to invite ManagerX to your Discord server. + +- Use the official `Invite Link `_. +- Ensure you have **Manage Server** permissions on the target server. +- Leave the requested permissions checked to ensure all modules (like Moderation and Auto-Role) work correctly. + +2. Run the Setup Command +======================== + +Once the bot joins, it will automatically try to initialize. You can also manually trigger the setup: + +.. code-block:: none + + /setup + +This command will: +- Check for required permissions. +- Initialize the local server database. +- Create a default configuration. + +3. Access the Dashboard +======================= + +Most of ManagerX's features are configured through our web interface. + +1. Visit `ManagerX Dashboard `_. +2. Log in with your Discord account. +3. Select your server from the list. +4. Start configuring modules like **Anti-Spam**, **Welcome Messages**, and **Levels**. + +4. Core Commands +================ + +Here are a few commands to get you started: + +- ``/help`` - Shows all available command categories. +- ``/settings`` - Quick access to server configuration. +- ``/stats`` - View your current server's activity. + +Next Steps +========== + +- **Setup Moderation:** Head over to the :doc:`moderation` guide. +- **Configure Levels:** Check the :doc:`levels` section to engage your members. +- **Customization:** Learn how to change the bot's look in :doc:`dashboard`. diff --git a/docs/source/user_guide/index.rst b/docs/source/user_guide/index.rst new file mode 100644 index 0000000..dd3d592 --- /dev/null +++ b/docs/source/user_guide/index.rst @@ -0,0 +1,31 @@ +===================== +👥 User Guide +===================== + +Welcome to the ManagerX User Guide! This section covers everything you need to know about using ManagerX on your server, from the initial invitation to advanced configuration. + +.. toctree:: + :maxdepth: 2 + :caption: Content: + + getting_started + moderation + levels + management + dashboard + faq/index + +--- + +🚀 Quick Links +============== + +- **Getting Started:** New here? Start with the :doc:`getting_started` guide. +- **Moderation:** Learn how to keep your server safe in the :doc:`moderation` section. +- **Engagement:** Discover the :doc:`levels` and rewards system. +- **Settings:** Use the :doc:`dashboard` to configure every detail. + +💡 Need Help? +============== + +If you don't find what you're looking for, feel free to join our `Support Discord `_ or check our :doc:`faq/index`. diff --git a/docs/source/user_guide/levels.rst b/docs/source/user_guide/levels.rst new file mode 100644 index 0000000..3519fd6 --- /dev/null +++ b/docs/source/user_guide/levels.rst @@ -0,0 +1,44 @@ +======================= +📈 Levels & Engagement +======================= + +The ManagerX Level System rewards your members for being active in your community. It encourages high-quality discussions and long-term engagement. + +1. How it works +=============== + +Members earn **Experience Points (XP)** for various activities: + +- **Text Messages:** Random amount of XP (typically 15-25) per message sent. +- **Voice Chat:** XP earned per minute spent in a voice channel (active members only, muted/deafened users earn less). +- **Cooldown:** There is a 60-second cooldown between XP gains from messages to prevent spamming. + +2. Levels and Roles +=================== + +As members accumulate XP, they reach higher levels. You can configure **Role Rewards** that are automatically granted upon reaching specific levels. + +- **Example:** Level 10 -> "Active Member" role, Level 50 -> "Server Veteran" role. +- **Stacking:** Choose whether users keep their previous reward roles or only hold the highest one. + +3. Commands +=========== + +- ``/rank [user]`` - View your current level, total XP, and progress to the next level. +- ``/leaderboard`` - See the top active members of the server. +- ``/profile`` - View your customizable user card. + +4. Configuration +================ + +Visit the **Dashboard -> Levels** tab to: + +- **Toggle Modules:** Turn the entire level system on or off. +- **Set Multipliers:** Grant extra XP in specific channels or for specific roles (e.g., Boosters). +- **Manage Roles:** Add, edit, or remove role rewards. +- **Level Up Messages:** Choose where level-up notifications are sent (Current channel, Private DM, or a dedicated channel). + +💡 Tip +====== + +You can use "XP-Excluded Channels" to prevent users from farming levels in bot-command or spam channels. diff --git a/docs/source/user_guide/management.rst b/docs/source/user_guide/management.rst new file mode 100644 index 0000000..852626c --- /dev/null +++ b/docs/source/user_guide/management.rst @@ -0,0 +1,55 @@ +======================== +⚙️ Server Management +======================== + +ManagerX automates repetitive server tasks so you can focus on building your community. + +1. Welcome & Goodbye +==================== + +First impressions matter! Use the Welcome module to greet new members. + +- **Custom Messages:** Use placeholders like ``{user}``, ``{server}``, and ``{member_count}``. +- **Direct Messages:** Send a private greeting to new members. +- **Auto-Roles:** Automatically grant roles to users when they join (e.g., a "Member" role). +- **Delayed Roles:** Grant roles after a set time to bypass Discord's "Member Screening". + +**Configuration:** +Dashboard -> **Welcome** & **Auto-Role** tabs. + +2. Global Chat Network +====================== + +Connect your server's channels to other communities across the ManagerX network. + +- **Cross-Server Sync:** Messages sent in your designated channel appear on all other connected servers. +- **Smart Filtering:** Anti-spam and bad-word filters apply globally. +- **Staff Support:** ManagerX staff monitors the global chat to ensure safety. + +**Setup:** +1. Choose a channel. +2. Go to **Dashboard -> Global Chat**. +3. Enable sync for that channel. + +3. Temporary Voice Channels (Temp-VC) +===================================== + +Allow your members to create their own private voice channels on demand. + +- **Join-to-Create:** When a user joins a specific "Generator" channel, a new private channel is created for them. +- **Ownership:** The creator can rename the channel and set member limits. +- **Auto-Cleanup:** The channel is automatically deleted once the last person leaves. + +**Setup:** +Go to **Dashboard -> Temp-VC** and designate your generator category/channel. + +4. Auto-Delete +============== + +Keep your channels clean by automatically deleting messages after a certain time. + +- **Use Cases:** Commands channels, media-only channels, or temporary announcements. +- **Filters:** Delete only bot messages, only images, or all messages. + +**Setup:** +Dashboard -> **Auto-Delete**. diff --git a/docs/source/user_guide/moderation.rst b/docs/source/user_guide/moderation.rst new file mode 100644 index 0000000..a891e3e --- /dev/null +++ b/docs/source/user_guide/moderation.rst @@ -0,0 +1,60 @@ +======================= +🛡️ Moderation +======================= + +ManagerX provides a suite of advanced moderation tools designed to keep your community safe with minimal manual effort. + +1. Anti-Spam System +=================== + +Our intelligent anti-spam system monitors messages in real-time to detect and prevent disruptive behavior. + +- **Fast Message Detection:** Detects users sending too many messages in a short interval. +- **Link Filter:** Blocks unauthorized links and protects against phishing. +- **Caps Filter:** Automatically warns or deletes messages with excessive uppercase letters. +- **Mention Spam:** Prevents users from mass-tagging members or roles. + +**Configuration:** +Enabled/Disabled via the **Dashboard -> Anti-Spam** tab. + +2. Warning System +================= + +ManagerX uses a tiered warning system to handle rule-breakers fairly. + +- ``/warn `` - Issue a formal warning. +- ``/warnings `` - View a user's warning history. +- ``/clearwarn `` - Remove warnings. + +**Auto-Mod Actions:** +You can configure "Warn Thresholds" in the Dashboard. For example: +- **3 Warnings:** 1-hour Timeout. +- **5 Warnings:** Temporary Ban (24h). +- **10 Warnings:** Permanent Ban. + +3. Triage Tools (Kicks & Bans) +============================== + +Classic moderation commands with a focus on speed and logging: + +- ``/ban [reason] [delete_messages_days]`` +- ``/kick [reason]`` +- ``/timeout [reason]`` +- ``/unban `` + +4. Audit Logging +================ + +The logging system tracks every significant event on your server to ensure accountability. + +**Monitored Events:** +- Message edits and deletions. +- Member joins and leaves. +- Role changes. +- Voice channel activity. +- Moderation actions (Warns, Bans, etc.). + +**How to Setup Logs:** +1. Create a private channel for logs. +2. Go to **Dashboard -> Logging**. +3. Select your channel and choose which events to track. diff --git a/mxmariadb/levelsystem_db.py b/mxmariadb/levelsystem_db.py index df133ea..9f225af 100644 --- a/mxmariadb/levelsystem_db.py +++ b/mxmariadb/levelsystem_db.py @@ -47,6 +47,12 @@ def __init__(self): self.level_roles_cache: Dict[int, Dict[int, int]] = {} self.enabled_guilds_cache: set = set() self.guild_configs_cache: Dict[int, Dict] = {} + self._initialized = False + + async def _ensure_initialized(self): + """Lazy init: create tables on first use if not already done.""" + if not self._initialized: + await self.init_db() async def init_db(self): """Create tables and load caches.""" @@ -132,6 +138,7 @@ async def init_db(self): ) ''') await conn.commit() + self._initialized = True await self.load_caches() logger.info("MariaDB levelsystem tables initialized") @@ -158,6 +165,7 @@ async def load_caches(self): async def add_xp(self, user_id: int, guild_id: int, xp_amount: int, message_content: str = "") -> Tuple[bool, int]: + await self._ensure_initialized() current_time = time.time() if self.anti_spam.is_spam(user_id, current_time): return False, 0 @@ -198,6 +206,7 @@ async def add_xp(self, user_id: int, guild_id: int, xp_amount: int, return level_up, new_level async def get_user_stats(self, user_id: int, guild_id: int): + await self._ensure_initialized() async with self.pool.acquire() as conn: async with conn.cursor() as cur: await cur.execute( @@ -212,6 +221,7 @@ async def get_user_stats(self, user_id: int, guild_id: int): return None async def get_leaderboard(self, guild_id: int, limit: int = 10) -> List[Tuple]: + await self._ensure_initialized() async with self.pool.acquire() as conn: async with conn.cursor() as cur: await cur.execute( @@ -222,6 +232,7 @@ async def get_leaderboard(self, guild_id: int, limit: int = 10) -> List[Tuple]: return await cur.fetchall() async def get_user_rank(self, user_id: int, guild_id: int) -> int: + await self._ensure_initialized() async with self.pool.acquire() as conn: async with conn.cursor() as cur: await cur.execute( @@ -242,6 +253,7 @@ async def get_user_rank(self, user_id: int, guild_id: int) -> int: return (await cur.fetchone())[0] async def get_active_xp_multiplier(self, guild_id: int, user_id: int) -> float: + await self._ensure_initialized() async with self.pool.acquire() as conn: async with conn.cursor() as cur: ct = time.time() @@ -257,6 +269,7 @@ async def get_active_xp_multiplier(self, guild_id: int, user_id: int) -> float: # --- Config --- async def set_guild_config(self, guild_id: int, **config): + await self._ensure_initialized() async with self.pool.acquire() as conn: async with conn.cursor() as cur: keys = list(config.keys()) + ['guild_id'] @@ -274,6 +287,7 @@ async def set_guild_config(self, guild_id: int, **config): self.guild_configs_cache[guild_id].update(config) async def get_guild_config(self, guild_id: int) -> Dict[str, Any]: + await self._ensure_initialized() if guild_id in self.guild_configs_cache: return self.guild_configs_cache[guild_id] async with self.pool.acquire() as conn: @@ -299,6 +313,7 @@ async def get_guild_config(self, guild_id: int) -> Dict[str, Any]: async def add_level_role(self, guild_id: int, level: int, role_id: int, is_temporary: bool = False, duration_hours: int = 0): + await self._ensure_initialized() async with self.pool.acquire() as conn: async with conn.cursor() as cur: await cur.execute(''' @@ -313,6 +328,7 @@ async def add_level_role(self, guild_id: int, level: int, role_id: int, self.level_roles_cache[guild_id][level] = role_id async def remove_level_role(self, guild_id: int, level: int): + await self._ensure_initialized() async with self.pool.acquire() as conn: async with conn.cursor() as cur: await cur.execute( @@ -323,6 +339,7 @@ async def remove_level_role(self, guild_id: int, level: int): del self.level_roles_cache[guild_id][level] async def get_level_roles(self, guild_id: int) -> List[Tuple]: + await self._ensure_initialized() async with self.pool.acquire() as conn: async with conn.cursor() as cur: await cur.execute( @@ -338,6 +355,7 @@ def get_role_for_level(self, guild_id: int, level: int) -> Optional[int]: return None async def set_levelsystem_enabled(self, guild_id: int, enabled: bool): + await self._ensure_initialized() await self.set_guild_config(guild_id, levelsystem_enabled=enabled) if enabled: self.enabled_guilds_cache.add(guild_id) @@ -365,6 +383,7 @@ def xp_for_level(level: int) -> int: # --- Maintenance --- async def delete_user_data(self, user_id: int) -> bool: + await self._ensure_initialized() try: async with self.pool.acquire() as conn: async with conn.cursor() as cur: @@ -378,6 +397,7 @@ async def delete_user_data(self, user_id: int) -> bool: return False async def cleanup_old_data(self, days: int = 30) -> int: + await self._ensure_initialized() cutoff = time.time() - (days * 86400) try: async with self.pool.acquire() as conn: @@ -388,4 +408,4 @@ async def cleanup_old_data(self, days: int = 30) -> int: await conn.commit() return deleted except Exception: - return 0 + return 0 \ No newline at end of file diff --git a/package.json b/package.json index 56be7e0..bbc78d9 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,13 @@ { "name": "vite_react_shadcn_ts", "private": true, - "version": "0.0.0", + "version": "2.0.0", "type": "module", "scripts": { "dev": "vite", "build": "vite build", "build:dev": "vite build --mode development", - "lint": "eslint .", + "lint": "eslint src/web", "preview": "vite preview", "test": "vitest run", "test:watch": "vitest" @@ -73,7 +73,7 @@ "@types/node": "24.12.0", "@types/react": "19.2.14", "@types/react-dom": "19.2.3", - "@vitejs/plugin-react-swc": "4.3.0", + "@vitejs/plugin-react-swc": "4.2.3", "autoprefixer": "10.4.27", "eslint": "10.0.3", "eslint-plugin-react-hooks": "7.0.1", @@ -84,7 +84,7 @@ "tailwindcss": "4.2.1", "typescript": "5.9.3", "typescript-eslint": "8.57.0", - "vite": "8.0.0", - "vitest": "4.1.0" + "vite": "7.3.1", + "vitest": "4.0.18" } } \ No newline at end of file diff --git a/public/fonts/inter-latin-ext.woff2 b/public/fonts/inter-latin-ext.woff2 new file mode 100644 index 0000000..479d010 Binary files /dev/null and b/public/fonts/inter-latin-ext.woff2 differ diff --git a/public/fonts/inter-latin.woff2 b/public/fonts/inter-latin.woff2 new file mode 100644 index 0000000..d15208d Binary files /dev/null and b/public/fonts/inter-latin.woff2 differ diff --git a/public/fonts/space-grotesk-latin-ext.woff2 b/public/fonts/space-grotesk-latin-ext.woff2 new file mode 100644 index 0000000..db732c2 Binary files /dev/null and b/public/fonts/space-grotesk-latin-ext.woff2 differ diff --git a/public/fonts/space-grotesk-latin.woff2 b/public/fonts/space-grotesk-latin.woff2 new file mode 100644 index 0000000..0f3474e Binary files /dev/null and b/public/fonts/space-grotesk-latin.woff2 differ diff --git a/src/web/App.tsx b/src/web/App.tsx index cc3e524..25f7aa7 100644 --- a/src/web/App.tsx +++ b/src/web/App.tsx @@ -136,15 +136,18 @@ const AppContent = () => { }; import { AuthProvider } from "./components/AuthProvider"; +import { ErrorBoundary } from "./components/ErrorBoundary"; const App = () => ( - - - - - - - + + + + + + + + + ); export default App; diff --git a/src/web/components/AuthProvider.tsx b/src/web/components/AuthProvider.tsx index bb858bd..ebf8166 100644 --- a/src/web/components/AuthProvider.tsx +++ b/src/web/components/AuthProvider.tsx @@ -16,17 +16,42 @@ const AuthContext = createContext(undefined); import { API_URL } from "../lib/api"; export const AuthProvider = ({ children }: { children: ReactNode }) => { - const [token, setToken] = useState(localStorage.getItem("token")); - const [user, setUser] = useState(JSON.parse(localStorage.getItem("user") || "null")); + const getSafeItem = (key: string) => { + try { + return localStorage.getItem(key); + } catch (e) { + console.warn(`Error reading ${key} from localStorage:`, e); + return null; + } + }; + + const getSafeJSON = (key: string) => { + const item = getSafeItem(key); + if (!item) return null; + try { + return JSON.parse(item); + } catch (e) { + console.error(`Error parsing ${key} from localStorage:`, e); + localStorage.removeItem(key); // Clear corrupted data + return null; + } + }; + + const [token, setToken] = useState(getSafeItem("token")); + const [user, setUser] = useState(getSafeJSON("user")); const [guilds, setGuilds] = useState([]); - const [selectedGuildId, setSelectedGuildId] = useState(localStorage.getItem("selectedGuildId")); + const [selectedGuildId, setSelectedGuildId] = useState(getSafeItem("selectedGuildId")); const login = (newToken: string, newUser: any, newDiscordToken?: string) => { setToken(newToken); setUser(newUser); - localStorage.setItem("token", newToken); - localStorage.setItem("user", JSON.stringify(newUser)); - if (newDiscordToken) localStorage.setItem("discord_token", newDiscordToken); + try { + localStorage.setItem("token", newToken); + localStorage.setItem("user", JSON.stringify(newUser)); + if (newDiscordToken) localStorage.setItem("discord_token", newDiscordToken); + } catch (e) { + console.error("Error saving to localStorage:", e); + } }; const logout = () => { @@ -34,7 +59,11 @@ export const AuthProvider = ({ children }: { children: ReactNode }) => { setUser(null); setGuilds([]); setSelectedGuildId(null); - localStorage.clear(); + try { + localStorage.clear(); + } catch (e) { + console.error("Error clearing localStorage:", e); + } }; // --- AUTOMATISCHER CALLBACK-HANDLER --- @@ -92,7 +121,11 @@ export const AuthProvider = ({ children }: { children: ReactNode }) => { isAuthenticated: !!token, login, logout, setSelectedGuildId: (id) => { setSelectedGuildId(id); - localStorage.setItem("selectedGuildId", id); + try { + localStorage.setItem("selectedGuildId", id); + } catch (e) { + console.error("Error saving selectedGuildId to localStorage:", e); + } } }}> {children} diff --git a/src/web/components/ErrorBoundary.tsx b/src/web/components/ErrorBoundary.tsx new file mode 100644 index 0000000..7041ebc --- /dev/null +++ b/src/web/components/ErrorBoundary.tsx @@ -0,0 +1,61 @@ +import React, { Component, ErrorInfo, ReactNode } from "react"; +import { motion } from "framer-motion"; + +interface Props { + children: ReactNode; +} + +interface State { + hasError: boolean; + error: Error | null; +} + +export class ErrorBoundary extends Component { + public state: State = { + hasError: false, + error: null, + }; + + public static getDerivedStateFromError(error: Error): State { + return { hasError: true, error }; + } + + public componentDidCatch(error: Error, errorInfo: ErrorInfo) { + console.error("Uncaught error:", error, errorInfo); + } + + public render() { + if (this.state.hasError) { + return ( +
+ +
+ ⚠️ +
+

Ups! Etwas ist schiefgelaufen.

+

+ Die Website konnte nicht korrekt geladen werden. Bitte versuche die Seite neu zu laden oder leere deinen Cache. +

+ {this.state.error && ( +
+ {this.state.error.message} +
+ )} + +
+
+ ); + } + + return this.props.children; + } +} diff --git a/src/web/components/Features.tsx b/src/web/components/Features.tsx index 4bd712c..b2d30a6 100644 --- a/src/web/components/Features.tsx +++ b/src/web/components/Features.tsx @@ -66,47 +66,47 @@ const featureCategories = [ export const Features = memo(function Features() { return ( -
- {/* Premium Background */} -
-
-
+
+ {/* Ultra-Premium Background */} +
+
+
- {/* Section Header */} -
+ {/* Elite Section Header */} +
- - Leistungsstarke Features + + Next-Gen Architecture - Alles für dein
- Discord Universum + Dominanz durch
+ Technologie
- Von moderner Server-Sicherheit bis hin zu interaktiven Community-Tools – wir haben alles an Bord. + Von hochperformanter Datenbank-Migration bis hin zu KI-gestützter Moderation – wir setzen neue Maßstäbe für deinen Discord-Server.
- {/* Feature Cards Grid */} -
+ {/* Feature Cards Elite Grid */} +
{featureCategories.map((category, index) => ( ))}
diff --git a/src/web/components/Footer.tsx b/src/web/components/Footer.tsx index 3589f13..ac95075 100644 --- a/src/web/components/Footer.tsx +++ b/src/web/components/Footer.tsx @@ -11,10 +11,10 @@ const socialLinks = [ export const Footer = memo(function Footer() { return (