Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,29 @@ classifiers = [

# Korrigierte Syntax: Direktes Array
dependencies = [
"ezcord==0.7.4",
"py-cord==2.7.1",
"aiosqlite==0.22.1",
"aiohttp==3.13.3",
"aiocache==0.12.3",
"propcache==0.4.1",
"requests==2.32.5",
"wikipedia==1.4.0",
"beautifulsoup4==4.14.3",
"soupsieve==2.8.3",
"yarl==1.23.0",
"frozenlist==1.8.0",
"h11==0.16.0",
"multidict==6.7.1",
"SimpleColoredLogs==1.16.1.2026",
"FastAPI==0.135.1",
"uvicorn==0.41.0",
"Jinja2==3.1.6",
"MarkupSafe==3.0.3",
"starlette==0.52.1",
"timedelta==2020.12.3",
"ManagerX-Handler==1.2026.2.9.4",
"ManagerX-DevTools==1.2026.2.26"
"ezcord>=0.7.4",
"py-cord>=2.7.1",
"aiosqlite>=0.22.1",
"aiohttp>=3.13.3",
"aiocache>=0.12.3",
"propcache>=0.4.1",
"requests>=2.32.5",
"wikipedia>=1.4.0",
"beautifulsoup4>=4.14.3",
"soupsieve>=2.8.3",
"yarl>=1.23.0",
"frozenlist>=1.8.0",
"h11>=0.16.0",
"multidict>=6.7.1",
"SimpleColoredLogs>=1.16.1.2026",
"FastAPI>=0.135.1",
"uvicorn>=0.41.0",
"Jinja2>=3.1.6",
"MarkupSafe>=3.0.3",
"starlette>=0.52.1",
"timedelta>=2020.12.3",
"ManagerX-Handler>=1.2026.2.9.4",
"ManagerX-DevTools>=1.2026.3.24"
]

[project.urls]
Expand Down
138 changes: 69 additions & 69 deletions requirements/req.txt
Original file line number Diff line number Diff line change
@@ -1,86 +1,86 @@
# --- Deine Online Packages (ManagerX Ecosystem) ---
ManagerX-DevTools==1.2026.3.15
ManagerX-Handler==1.2026.2.9.4
ManagerX-DevTools>=1.2026.3.15
ManagerX-Handler>=1.2026.2.9.4

# --- Core Frameworks & Discord ---
ezcord==0.7.4
py-cord==2.7.1
better-ipc==2.0.3
fastapi==0.135.1
uvicorn==0.41.0
starlette==0.52.1
PyJWT==2.10.1
ezcord>=0.7.4
py-cord>=2.7.1
better-ipc>=2.0.3
fastapi>=0.135.1
uvicorn>=0.41.0
starlette>=0.52.1
PyJWT>=2.10.1

# --- Async & Performance ---
aiocache==0.12.3
aiohappyeyeballs==2.6.1
aiohttp==3.13.3
aiosignal==1.4.0
aiosqlite==0.22.1
anyio==4.12.1
frozenlist==1.8.0
multidict==6.7.1
propcache==0.4.1
sniffio==1.3.1
websockets==16.0
aiocache>=0.12.3
aiohappyeyeballs>=2.6.1
aiohttp>=3.13.3
aiosignal>=1.4.0
aiosqlite>=0.22.1
anyio>=4.12.1
frozenlist>=1.8.0
multidict>=6.7.1
propcache>=0.4.1
sniffio>=1.3.1
websockets>=16.0

# --- Data & Validation ---
annotated-types==0.7.0
pydantic==2.12.5
pydantic_core==2.41.5
PyYAML==6.0.1
typing_extensions==4.15.0
typing-inspection==0.4.2
annotated-types>=0.7.0
pydantic>=2.12.5
pydantic_core>=2.41.5
PyYAML>=6.0.1
typing_extensions>=4.15.0
typing-inspection>=0.4.2

# --- HTTP & Web ---
requests==2.32.5
requests-toolbelt==1.0.0
httpx==0.24.1
httpcore==0.17.3
h11==0.14.0
urllib3==2.1.0
yarl==1.23.0
certifi==2026.2.25
charset-normalizer==3.4.5
idna==3.11
rfc3986==1.5.0
requests>=2.32.5
requests-toolbelt>=1.0.0
httpx>=0.24.1
httpcore>=0.17.3
h11>=0.14.0
urllib3>=2.1.0
yarl>=1.23.0
certifi>=2026.2.25
charset-normalizer>=3.4.5
idna>=3.11
rfc3986>=1.5.0

# --- UI, Imaging & Logging ---
beautifulsoup4==4.14.3
soupsieve==2.8.3
easy-pil==0.4.0
pillow==10.4.0
SimpleColoredLogs==1.16.1.2026
colorama==0.4.6
rich==13.5.2
Pygments==2.19.2
markdown-it-py==3.0.0
mdurl==0.1.2
beautifulsoup4>=4.14.3
soupsieve>=2.8.3
easy-pil>=0.4.0
pillow>=10.4.0
SimpleColoredLogs>=1.16.1.2026
colorama>=0.4.6
rich>=13.5.2
Pygments>=2.19.2
markdown-it-py>=3.0.0
mdurl>=0.1.2

# --- System & Utilities ---
click==8.3.1
psutil==5.9.5
python-dotenv==1.2.2
timedelta==2020.12.3
pytz==2026.1.post1
datetime==5.1
six==1.17.0
cffi==2.0.0
pycparser==3.0
PyNaCl==1.6.2
zope.interface==8.2
click>=8.3.1
psutil>=5.9.5
python-dotenv>=1.2.2
timedelta>=2020.12.3
pytz>=2026.1.post1
datetime>=5.1
six>=1.17.0
cffi>=2.0.0
pycparser>=3.0
PyNaCl>=1.6.2
zope.interface>=8.2

# --- Template Engines ---
Jinja2==3.1.6
MarkupSafe==3.0.3
Jinja2>=3.1.6
MarkupSafe>=3.0.3

# --- Helpers & Docs ---
wikipedia==1.4.0
packaging==26.0
pathlib==1.0.1
more-itertools==10.8.0
jaraco.classes==3.4.0
jaraco.context==6.1.1
jaraco.functools==4.4.0
docutils==0.22.4
nh3==0.3.2
wikipedia>=1.4.0
packaging>=26.0
pathlib>=1.0.1
more-itertools>=10.8.0
jaraco.classes>=3.4.0
jaraco.context>=6.1.1
jaraco.functools>=4.4.0
docutils>=0.22.4
nh3>=0.3.2
40 changes: 40 additions & 0 deletions src/api/dashboard/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,46 @@ async def get_stats(request: Request):
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))

@router_public.get("/leaderboard")
async def get_leaderboard(limit: int = 50):
"""
Fetches the global leaderboard from StatsDB and enriches it with Discord data.
"""
from mx_devtools import StatsDB
if bot_instance is None:
raise HTTPException(status_code=503, detail="Bot-Verbindung nicht verfügbar")

try:
stats_db = StatsDB()
# get_leaderboard returns user_id, global_level, global_xp, total_messages, total_voice_minutes
rows = await stats_db.get_leaderboard(limit=limit)

leaderboard = []
for row in rows:
uid = row[0]
# Try to get user from cache first
user = bot_instance.get_user(uid)

# If not in cache, we don't fetch_user here to avoid hitting rate limits
# and slowing down the request significantly for 50 users.

username = user.name if user else f"User {uid}"
avatar = user.display_avatar.url if user else None

leaderboard.append({
"user_id": str(uid),
"username": username,
"avatar_url": avatar,
"level": row[1],
"xp": row[2],
"messages": row[3],
"voice_minutes": round(row[4], 1)
})

return {"success": True, "leaderboard": leaderboard}
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))

@router_public.get("/version")
async def get_version(request: Request):
return {
Expand Down
6 changes: 5 additions & 1 deletion src/api/dashboard/user_routes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from fastapi import APIRouter, Request, HTTPException, Depends
from src.api.dashboard.auth_routes import get_current_user
from mx_devtools import SettingsDB, StatsDB
from mx_devtools import SettingsDB, StatsDB, EconomyDatabase
import discord
import sqlite3
import os
Expand Down Expand Up @@ -110,6 +110,10 @@ async def get_user_settings(user: dict = Depends(get_current_user)):
"global_chat": {
"total_messages": global_chat_messages
},
"economy": {
"global_coins": EconomyDatabase().get_global_balance(user_id),
"overrides": EconomyDatabase().get_equipped_overrides(user_id)
},
"top_servers": top_servers
}
}
Expand Down
51 changes: 51 additions & 0 deletions src/bot/cogs/bot/botjoinevent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import discord
from discord.ui import Container # Dein ezcord/discord.ui Import
import ezcord

class BotJoinEvents(ezcord.Cog):
def __init__(self, bot):
self.bot = bot

@ezcord.Cog.listener()
async def on_guild_join(self, guild):
# Den Serverbesitzer schnappen
owner = guild.owner

if owner:
# Container erstellen (Passend zu deinem Branding in Rot)
container = Container(color=discord.Color.red())

# Content im Container-Style aufbauen
container.add_text(f"# 👋 Hello! I am {self.bot.user.name}")
container.add_text(
f"Thanks for inviting me to **{guild.name}**! I'm here to support you with "
"**Moderation, Global Chat, and Economy**."
)

container.add_separator()

container.add_text("### 🏆 Current Season")
container.add_text("Check out the global leaderboard using `/stats`!")

container.add_text("### 🛠️ Setup")
container.add_text("Use `/help` to configure my settings.")

container.add_separator()

container.add_text("### 🔗 Links")
container.add_text("🔗 [Website](https://managerx-bot.de) × [Top.gg](https://top.gg/bot/1368201272624287754) × [Support](https://discord.gg/9T28DWup3g) × [GitHub](https://github.com/ManagerX-Development/ManagerX)")

# Die DesignerView für den Container erstellen
view = discord.ui.DesignerView(container, timeout=0)

try:
# Den modernen Container per DM an den Owner senden
await owner.send(view=view)
except discord.Forbidden:
# Falls DMs beim Owner zu sind
pass
except Exception as e:
print(f"Error sending Container-DM: {e}")

def setup(bot):
bot.add_cog(BotJoinEvents(bot))
File renamed without changes.
File renamed without changes.
Loading
Loading