test
This commit is contained in:
parent
b22205a2fd
commit
a6f82bbd6c
@ -1,35 +0,0 @@
|
|||||||
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] });
|
|
||||||
},
|
|
||||||
};
|
|
||||||
@ -35,9 +35,12 @@ module.exports = {
|
|||||||
for (const link of chunk) {
|
for (const link of chunk) {
|
||||||
const user = await interaction.client.users.fetch(link.discord_id).catch(() => null);
|
const user = await interaction.client.users.fetch(link.discord_id).catch(() => null);
|
||||||
const discordName = user ? user.globalName : link.discord_username;
|
const discordName = user ? user.globalName : link.discord_username;
|
||||||
|
const lastConn = link.lastConnection
|
||||||
|
? `📅 Dernière connexion: <t:${Math.floor(new Date(link.lastConnection).getTime() / 1000)}:R>`
|
||||||
|
: '📅 Dernière connexion: Jamais vu';
|
||||||
embed.addFields({
|
embed.addFields({
|
||||||
name: `👤 ${discordName}`,
|
name: `👤 ${discordName}`,
|
||||||
value: `🎮 Palworld: **${link.palworld_username}**\n🆔 Steam ID: \`${link.steam_id}\`\n🎯 Player ID: \`${link.player_id || 'N/A'}\`\n📅 Lié le: ${new Date(link.linked_at).toLocaleDateString('fr-FR')}`,
|
value: `🎮 Palworld: **${link.palworld_username}**\n🆔 Steam ID: \`${link.steam_id}\`\n🎯 Player ID: \`${link.player_id || 'N/A'}\`\n ${lastConn}\n📅 Lié le: ${new Date(link.linked_at).toLocaleDateString('fr-FR')}`,
|
||||||
inline: false
|
inline: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user