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
15 changes: 14 additions & 1 deletion src/api/dashboard/user_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
@router.get("/settings")
async def get_user_settings(user: dict = Depends(get_current_user)):
"""Fetch user settings from SettingsDB."""
from src.api.dashboard.routes import bot_instance
settings_db = SettingsDB()
try:
user_id = int(user["id"])
Expand Down Expand Up @@ -75,8 +76,20 @@ async def get_user_settings(user: dict = Depends(get_current_user)):
""", (user_id,))
rows = cursor.fetchall()
for row in rows:
guild_id = row[0]
guild_name = "Unknown Server"
guild_icon = None

if bot_instance:
guild = bot_instance.get_guild(guild_id)
if guild:
guild_name = guild.name
guild_icon = guild.icon.url if guild.icon else None

top_servers.append({
"guild_id": str(row[0]),
"guild_id": str(guild_id),
"name": guild_name,
"icon_url": guild_icon,
"level": row[1],
"xp": row[2]
})
Expand Down
4 changes: 2 additions & 2 deletions src/bot/cogs/guild/loggingsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -924,8 +924,8 @@ async def on_voice_state_update(self, member: discord.Member, before: discord.Vo
changes.append(f"Server Mute: {'✅' if after.mute else '❌'}")
if before.deaf != after.deaf:
changes.append(f"Server Deaf: {'✅' if after.deaf else '❌'}")
if before.streaming != after.streaming:
changes.append(f"Streaming: {'✅' if after.streaming else '❌'}")
if getattr(before, 'streaming', None) != getattr(after, 'streaming', None):
changes.append(f"Streaming: {'✅' if getattr(after, 'streaming', None) else '❌'}")
if before.self_video != after.self_video:
changes.append(f"Camera: {'✅' if after.self_video else '❌'}")

Expand Down
4 changes: 2 additions & 2 deletions src/bot/cogs/management/autodelete.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ async def _process_channel_deletion(self, channel_id, test_mode=False):

deleted_count = 0
error_count = 0
cutoff_time = datetime.utcnow() - timedelta(seconds=duration)
cutoff_time = discord.utils.utcnow() - timedelta(seconds=duration)

try:
messages_to_delete = []
Expand Down Expand Up @@ -265,7 +265,7 @@ async def _bulk_delete_messages(self, channel, messages):
# Trenne alte und neue Nachrichten (Discord API Limitation)
old_messages = []
new_messages = []
two_weeks_ago = datetime.utcnow() - timedelta(days=14)
two_weeks_ago = discord.utils.utcnow() - timedelta(days=14)

for msg in messages:
if msg.created_at < two_weeks_ago:
Expand Down
5 changes: 4 additions & 1 deletion src/bot/cogs/user/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,10 @@ async def global_stats_command(

# Activity stats
total_voice_hours = int(global_info['total_voice_minutes'] // 60)
days_since_joined = (datetime.now() - datetime.fromisoformat(global_info['first_seen'])).days + 1
first_seen = datetime.fromisoformat(global_info['first_seen'])
if first_seen.tzinfo is None:
first_seen = first_seen.replace(tzinfo=discord.utils.utcnow().tzinfo)
days_since_joined = (discord.utils.utcnow() - first_seen).days + 1
avg_messages_per_day = global_info['total_messages'] / days_since_joined

embed.add_field(
Expand Down
21 changes: 16 additions & 5 deletions src/web/dashboard/UserSettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -375,12 +375,23 @@ export default function UserSettingsPage() {
settings.topServers.map((srv: any, i: number) => (
<div key={i} className="flex items-center justify-between p-4 rounded-2xl bg-white/5 border border-white/10 group hover:border-yellow-500/30 transition-colors">
<div className="flex items-center gap-4">
<div className="w-10 h-10 rounded-xl bg-white/5 flex items-center justify-center font-bold text-yellow-500">
#{i + 1}
<div className="w-12 h-12 rounded-2xl bg-white/5 flex items-center justify-center overflow-hidden border border-white/10 shadow-inner group-hover:border-yellow-500/20 transition-all">
{srv.icon_url ? (
<img src={srv.icon_url} alt={srv.name} className="w-full h-full object-cover" />
) : (
<div className="w-full h-full flex items-center justify-center font-black text-yellow-500/50 bg-yellow-500/5">
{srv.name?.substring(0, 1).toUpperCase() || srv.guild_id.substring(0, 1)}
</div>
)}
</div>
<div>
<p className="text-xs font-bold text-white">Server ID: {srv.guild_id}</p>
<p className="text-[10px] font-bold uppercase tracking-widest text-slate-500">Level {srv.level}</p>
<div className="space-y-0.5">
<p className="text-sm font-bold text-white leading-tight group-hover:text-yellow-500 transition-colors">{srv.name}</p>
<div className="flex items-center gap-2">
<div className="px-1.5 py-0.5 rounded-md bg-white/5 border border-white/5">
<p className="text-[8px] font-black uppercase tracking-tighter text-slate-500">ID: {srv.guild_id}</p>
</div>
<p className="text-[10px] font-bold uppercase tracking-widest text-slate-500">Level {srv.level}</p>
</div>
</div>
</div>
<div className="text-right">
Expand Down
Loading