Skip to content

Conversation

@vined-underscore
Copy link
Collaborator

No description provided.

Copy link
Contributor

@AlexProgrammerDE AlexProgrammerDE left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi. The build is failing. Please address the issues

Copy link
Contributor

@AlexProgrammerDE AlexProgrammerDE left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except that one thing. looks mergeable

Comment on lines +21 to 49
let uptimeStr = "";
if (data.uptime.serverStartUnix) {
const diff = Math.floor(Date.now() / 1000 - data.uptime.serverStartUnix);
const days = Math.floor(diff / 86400);
const hours = Math.floor((diff % 86400) / 3600);
const minutes = Math.floor((diff % 3600) / 60);
const seconds = diff % 60;
const parts = [];
if (days > 0) parts.push(`${days}d`);
if (hours > 0) parts.push(`${hours}h`);
if (minutes > 0) parts.push(`${minutes}m`);
if (seconds > 0) parts.push(`${seconds}s`);
uptimeStr = parts.join(" ");
} else if (data.uptime.currentUptimeHours) {
const totalSeconds = Math.floor(data.uptime.currentUptimeHours * 3600);
const days = Math.floor(totalSeconds / 86400);
const hours = Math.floor((totalSeconds % 86400) / 3600);
const minutes = Math.floor((totalSeconds % 3600) / 60);
const seconds = totalSeconds % 60;
const parts = [];
if (days > 0) parts.push(`${days}d`);
if (hours > 0) parts.push(`${hours}h`);
if (minutes > 0) parts.push(`${minutes}m`);
if (seconds > 0) parts.push(`${seconds}s`);
uptimeStr = parts.join(" ");
} else {
await interaction.reply(`The server is currently down.`);
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there has got to be a better way to do this rather than to duplicate it twice.

maybe use some library
maybe use a shared function
preferably a library

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants