72 lines
2.9 KiB
JavaScript
72 lines
2.9 KiB
JavaScript
const { SlashCommandBuilder, EmbedBuilder, MessageFlags } = require('discord.js');
|
|
const { getUserLink } = require('../../database.js');
|
|
|
|
module.exports = {
|
|
data: new SlashCommandBuilder()
|
|
.setName('info')
|
|
.setDescription('Afficher les informations détaillées d\'un compte lié')
|
|
.addUserOption(option =>
|
|
option.setName('utilisateur')
|
|
.setDescription('L\'utilisateur Discord dont vous voulez voir les informations')
|
|
.setRequired(true)),
|
|
|
|
async execute(interaction) {
|
|
try {
|
|
await interaction.deferReply({});
|
|
|
|
const targetUser = interaction.options.getUser('utilisateur');
|
|
const link = await getUserLink(targetUser.id);
|
|
|
|
if (!link) {
|
|
return interaction.editReply({
|
|
content: `❌ Aucun compte lié trouvé pour ${targetUser.globalName || targetUser.username}.`,
|
|
flags: MessageFlags.Ephemeral
|
|
});
|
|
}
|
|
|
|
const lastConn = link.lastConnection
|
|
? `<t:${Math.floor(new Date(link.lastConnection).getTime() / 1000)}:R>`
|
|
: 'Jamais vu';
|
|
|
|
const linkedDate = `<t:${Math.floor(new Date(link.linked_at).getTime() / 1000)}:F>`;
|
|
|
|
const embed = new EmbedBuilder()
|
|
.setColor(0x0099FF)
|
|
.setTitle('📋 Informations du compte lié')
|
|
.setThumbnail(targetUser.displayAvatarURL({ dynamic: true }))
|
|
.addFields(
|
|
{
|
|
name: '👤 Discord',
|
|
value: `**Nom:** ${targetUser.globalName || targetUser.username}\n**Mention:** <@${targetUser.id}>\n**ID:** \`${targetUser.id}\``,
|
|
inline: false
|
|
},
|
|
{
|
|
name: '🎮 Palworld',
|
|
value: `**Pseudo:** ${link.palworld_username}\n**Player ID:** \`${link.player_id || 'N/A'}\``,
|
|
inline: true
|
|
},
|
|
{
|
|
name: '🎯 Steam',
|
|
value: `**Steam ID:** \`${link.steam_id}\``,
|
|
inline: true
|
|
},
|
|
{
|
|
name: '📅 Dates',
|
|
value: `**Lié le:** ${linkedDate}\n**Dernière connexion:** ${lastConn}`,
|
|
inline: false
|
|
}
|
|
)
|
|
.setTimestamp();
|
|
|
|
await interaction.editReply({ embeds: [embed] });
|
|
|
|
} catch (error) {
|
|
console.error('Erreur lors de la récupération des informations:', error);
|
|
await interaction.editReply({
|
|
content: '❌ Une erreur est survenue lors de la récupération des informations.',
|
|
flags: MessageFlags.Ephemeral
|
|
});
|
|
}
|
|
},
|
|
};
|