35 lines
1.3 KiB
JavaScript
35 lines
1.3 KiB
JavaScript
const { EmbedBuilder } = require('discord.js');
|
|
const { getAllLinks } = require('../database.js');
|
|
|
|
module.exports = {
|
|
data: {
|
|
name: 'afficher-lies',
|
|
description: 'Affiche la liste des comptes liés',
|
|
},
|
|
async execute(interaction) {
|
|
const links = await getAllLinks();
|
|
|
|
if (!links || links.length === 0) {
|
|
return interaction.reply({
|
|
content: 'Aucun compte lié trouvé.',
|
|
ephemeral: true
|
|
});
|
|
}
|
|
|
|
const embed = new EmbedBuilder()
|
|
.setColor('#00FF00')
|
|
.setTitle('👥 Liste des comptes liés')
|
|
.setDescription(links.map((link, index) => {
|
|
const lastConn = link.lastConnection
|
|
? `📅 Dernière connexion: <t:${Math.floor(new Date(link.lastConnection).getTime() / 1000)}:R>`
|
|
: '📅 Dernière connexion: Jamais vu';
|
|
|
|
return `**${index + 1}.** <@${link.discordId}> ${link.discordUsername ? `(${link.discordUsername})` : ''}\n` +
|
|
`└ 🎮 **${link.palworldName}** (Steam: \`${link.steamId}\`)\n` +
|
|
`└ ${lastConn}`;
|
|
}).join('\n\n'))
|
|
.setTimestamp();
|
|
|
|
return interaction.reply({ embeds: [embed] });
|
|
},
|
|
}; |