feat: refactor AI admin panel to use plain objects for improved structure and compatibility with Discord API V2

This commit is contained in:
2025-10-03 22:39:07 -05:00
parent 204b86e706
commit 1c769289c3
2 changed files with 103 additions and 93 deletions

View File

@@ -30,10 +30,16 @@ const getGuildIcon = (g?: Guild) => {
};
// Construye datos de invite similares a la versión previa
const getInviteObject = (invite?: Invite) => invite?.guild ? {
name: invite.guild.name,
icon: invite.guild.icon ? `https://cdn.discordapp.com/icons/${invite.guild.id}/${invite.guild.icon}.webp?size=256` : ''
} : null;
const getInviteObject = (invite?: Invite) => {
// En discord.js dev, necesitamos verificar si es GuildInvite
if (invite && 'guild' in invite && invite.guild) {
return {
name: invite.guild.name,
icon: invite.guild.icon ? `https://cdn.discordapp.com/icons/${invite.guild.id}/${invite.guild.icon}.webp?size=256` : ''
};
}
return null;
};
// Helper: calcula el rank dentro del servidor para un campo (weeklyPoints / monthlyPoints / totalPoints)
async function computeRankInGuild(