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
This commit is contained in:
parent
cf175b87e9
commit
6feaad75db
5 changed files with 32 additions and 4 deletions
4
.replit
4
.replit
|
|
@ -22,6 +22,10 @@ externalPort = 80
|
|||
localPort = 8080
|
||||
externalPort = 8080
|
||||
|
||||
[[ports]]
|
||||
localPort = 32905
|
||||
externalPort = 3000
|
||||
|
||||
[workflows]
|
||||
runButton = "Project"
|
||||
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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 },
|
||||
|
|
|
|||
|
|
@ -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`,
|
||||
|
|
|
|||
Loading…
Reference in a new issue