From 6feaad75db3781d69435d4d3c97a68eea97b1084 Mon Sep 17 00:00:00 2001 From: sirpiglr <49359077-sirpiglr@users.noreply.replit.com> Date: Mon, 8 Dec 2025 17:58:53 +0000 Subject: [PATCH] Update user profile displays to show custom avatar URLs when available Modify commands like badges, profile, rank, and stats to prioritize and validate user-provided HTTP/HTTPS avatar URLs over default display avatars. Replit-Commit-Author: Agent Replit-Commit-Session-Id: aed2e46d-25bb-4b73-81a1-bb9e8437c261 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 566d93fe-73b9-4076-a03a-cb3263aa2dab Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/3bdfff67-975a-46ad-9845-fbb6b4a4c4b5/aed2e46d-25bb-4b73-81a1-bb9e8437c261/19PeEhC Replit-Helium-Checkpoint-Created: true --- .replit | 4 ++++ aethex-bot/commands/badges.js | 8 +++++++- aethex-bot/commands/profile.js | 8 +++++++- aethex-bot/commands/rank.js | 8 +++++++- aethex-bot/commands/stats.js | 8 +++++++- 5 files changed, 32 insertions(+), 4 deletions(-) diff --git a/.replit b/.replit index 5b6f647..0e87d21 100644 --- a/.replit +++ b/.replit @@ -22,6 +22,10 @@ externalPort = 80 localPort = 8080 externalPort = 8080 +[[ports]] +localPort = 32905 +externalPort = 3000 + [workflows] runButton = "Project" diff --git a/aethex-bot/commands/badges.js b/aethex-bot/commands/badges.js index 720b75c..731fa87 100644 --- a/aethex-bot/commands/badges.js +++ b/aethex-bot/commands/badges.js @@ -78,10 +78,16 @@ module.exports = { earnedBadges = [...new Set(earnedBadges)]; + // Validate avatar URL - must be http/https, not base64 + let avatarUrl = target.displayAvatarURL(); + if (profile?.avatar_url && profile.avatar_url.startsWith('http')) { + avatarUrl = profile.avatar_url; + } + const embed = new EmbedBuilder() .setColor(0x7c3aed) .setTitle(`${profile?.username || target.tag}'s Badges`) - .setThumbnail(profile?.avatar_url || target.displayAvatarURL()) + .setThumbnail(avatarUrl) .setTimestamp(); if (earnedBadges.length > 0) { diff --git a/aethex-bot/commands/profile.js b/aethex-bot/commands/profile.js index 5e4aa71..474deb3 100644 --- a/aethex-bot/commands/profile.js +++ b/aethex-bot/commands/profile.js @@ -85,13 +85,19 @@ module.exports = { ? badges.map(b => getBadgeEmoji(b)).join(' ') : 'No badges yet'; + // Validate avatar URL - must be http/https, not base64 + let avatarUrl = targetUser.displayAvatarURL({ size: 256 }); + if (profile.avatar_url && profile.avatar_url.startsWith('http')) { + avatarUrl = profile.avatar_url; + } + const embed = new EmbedBuilder() .setColor(armColors[link.primary_arm] || 0x7c3aed) .setAuthor({ name: `${profile.full_name || profile.username || 'AeThex User'}`, iconURL: targetUser.displayAvatarURL({ size: 64 }) }) - .setThumbnail(profile.avatar_url || targetUser.displayAvatarURL({ size: 256 })) + .setThumbnail(avatarUrl) .setDescription(profile.bio || '*No bio set*') .addFields( { diff --git a/aethex-bot/commands/rank.js b/aethex-bot/commands/rank.js index 16f82d4..cc8e424 100644 --- a/aethex-bot/commands/rank.js +++ b/aethex-bot/commands/rank.js @@ -56,10 +56,16 @@ module.exports = { .select('*', { count: 'exact', head: true }) .gt('xp', xp); + // Validate avatar URL - must be http/https, not base64 + let avatarUrl = target.displayAvatarURL(); + if (profile?.avatar_url && profile.avatar_url.startsWith('http')) { + avatarUrl = profile.avatar_url; + } + const embed = new EmbedBuilder() .setColor(0x7c3aed) .setTitle(`${profile?.username || target.tag}'s Rank`) - .setThumbnail(profile?.avatar_url || target.displayAvatarURL()) + .setThumbnail(avatarUrl) .addFields( { name: 'Level', value: `**${level}**`, inline: true }, { name: 'Total XP', value: `**${xp.toLocaleString()}**`, inline: true }, diff --git a/aethex-bot/commands/stats.js b/aethex-bot/commands/stats.js index b51b6b8..c764777 100644 --- a/aethex-bot/commands/stats.js +++ b/aethex-bot/commands/stats.js @@ -73,10 +73,16 @@ module.exports = { (Date.now() - linkedDate.getTime()) / (1000 * 60 * 60 * 24) ); + // Validate avatar URL - must be http/https, not base64 + let avatarUrl = interaction.user.displayAvatarURL(); + if (profile?.avatar_url && profile.avatar_url.startsWith('http')) { + avatarUrl = profile.avatar_url; + } + const embed = new EmbedBuilder() .setColor(0x7289da) .setTitle(`📊 ${profile?.full_name || interaction.user.username}'s Stats`) - .setThumbnail(profile?.avatar_url || interaction.user.displayAvatarURL()) + .setThumbnail(avatarUrl) .addFields( { name: `${armEmojis[link.primary_arm] || "⚔️"} Primary Realm`,