test
This commit is contained in:
parent
a0db9ad2da
commit
33bcd082db
@ -38,24 +38,10 @@ module.exports = {
|
||||
const discordName = user ? (user.globalName ? user.globalName : user.username) : link.discord_username;
|
||||
const discordMention = `<@${link.discord_id}>`;
|
||||
|
||||
// Calculer le temps depuis la dernière connexion
|
||||
let lastConnectionText = '';
|
||||
if (link.lastConnection) {
|
||||
const lastConn = new Date(link.lastConnection);
|
||||
const now = new Date();
|
||||
const diffMs = now - lastConn;
|
||||
const diffMinutes = Math.floor(diffMs / 60000);
|
||||
const diffHours = Math.floor(diffMs / 3600000);
|
||||
const diffDays = Math.floor(diffMs / 86400000);
|
||||
|
||||
if (diffMinutes < 60) {
|
||||
lastConnectionText = ` - ${diffMinutes}min ago`;
|
||||
} else if (diffHours < 24) {
|
||||
lastConnectionText = ` - ${diffHours}h ago`;
|
||||
} else {
|
||||
lastConnectionText = ` - ${diffDays}d ago`;
|
||||
}
|
||||
}
|
||||
// date de la dernière connexion formatée pour affichage discord
|
||||
const lastConnectionText = link.last_palworld_connection
|
||||
? `<t:${Math.floor(new Date(link.last_palworld_connection).getTime() / 1000)}:f>`
|
||||
: 'Jamais connecté';
|
||||
|
||||
embed.addFields({
|
||||
name: `👤 ${discordName} - 🎮 ${link.palworld_username} - ${lastConnectionText}`,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user