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 discordName = user ? (user.globalName ? user.globalName : user.username) : link.discord_username;
|
||||||
const discordMention = `<@${link.discord_id}>`;
|
const discordMention = `<@${link.discord_id}>`;
|
||||||
|
|
||||||
// Calculer le temps depuis la dernière connexion
|
// date de la dernière connexion formatée pour affichage discord
|
||||||
let lastConnectionText = '';
|
const lastConnectionText = link.last_palworld_connection
|
||||||
if (link.lastConnection) {
|
? `<t:${Math.floor(new Date(link.last_palworld_connection).getTime() / 1000)}:f>`
|
||||||
const lastConn = new Date(link.lastConnection);
|
: 'Jamais connecté';
|
||||||
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({
|
embed.addFields({
|
||||||
name: `👤 ${discordName} - 🎮 ${link.palworld_username} - ${lastConnectionText}`,
|
name: `👤 ${discordName} - 🎮 ${link.palworld_username} - ${lastConnectionText}`,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user