test
This commit is contained in:
parent
4c1113f269
commit
aa025d9398
@ -38,10 +38,28 @@ 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`;
|
||||
}
|
||||
}
|
||||
|
||||
embed.addFields({
|
||||
name: `👤 ${discordName}`,
|
||||
value: `${discordMention}
|
||||
🎮 Palworld: **${link.palworld_username}**`
|
||||
name: `👤 ${discordName} - ${discordMention}`,
|
||||
value: `🎮 ${link.palworld_username}${lastConnectionText}`
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user