Skip to content

Commit

Permalink
fix lint complaints even though it made the code uglier
Browse files Browse the repository at this point in the history
  • Loading branch information
theimperious1 committed Dec 5, 2024
1 parent 27243fb commit 46523d9
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/discord/events/guildMemberRemove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,19 @@ export const guildMemberRemove: GuildMemberRemoveEvent = {

if (joinedTimestamp) {
const diff = Math.abs(Date.now() - joinedTimestamp);

// Helper to calculate units and update remaining time
const getUnit = (time: number, unitMs: number) => {
const value = Math.floor(time / unitMs);
return [value, time % unitMs];
};

let remaining = diff;

const remaining = diff;
const [years, afterYears] = getUnit(remaining, 1000 * 60 * 60 * 24 * 365);
const [months, afterMonths] = getUnit(afterYears, 1000 * 60 * 60 * 24 * 30);
const [weeks, afterWeeks] = getUnit(afterMonths, 1000 * 60 * 60 * 24 * 7);
const [days, afterDays] = getUnit(afterWeeks, 1000 * 60 * 60 * 24);
const [hours, afterHours] = getUnit(afterDays, 1000 * 60 * 60);
const [minutes, afterMinutes] = getUnit(afterHours, 1000 * 60);
const [seconds] = getUnit(afterMinutes, 1000);

// Build duration string dynamically
const duration = [
years && `${years} year${years > 1 ? 's' : ''}`,
Expand All @@ -54,7 +50,6 @@ export const guildMemberRemove: GuildMemberRemoveEvent = {
]
.filter(Boolean)
.join(', ');

embed.setDescription(`${member} has left the guild after ${duration}`);
} else {
embed.setDescription(`${member} has left the guild`);
Expand Down

0 comments on commit 46523d9

Please sign in to comment.