Skip to content
This repository has been archived by the owner on Jun 3, 2023. It is now read-only.

Commit

Permalink
Merge pull request #37 from Mirasaki/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Mirasaki authored Sep 10, 2022
2 parents 6082af2 + 9d2997b commit 3fe37ad
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 31 deletions.
6 changes: 1 addition & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@
"es2021": true,
"node": true
},
"plugins": [
"sonarjs"
],
"extends": [
"eslint:recommended",
"plugin:sonarjs/recommended"
"eslint:recommended"
],
"parserOptions": {
"ecmaVersion": "latest",
Expand Down
20 changes: 0 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
},
"devDependencies": {
"eslint": "^8.15.0",
"eslint-plugin-sonarjs": "^0.13.0",
"nodemon": "^2.0.16"
},
"repository": {
Expand Down
11 changes: 6 additions & 5 deletions src/commands/dayz/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ module.exports = {
}
},

// eslint-disable-next-line sonarjs/cognitive-complexity
run: async ({ client, interaction }) => {
// Destructuring and assignments
const { options } = interaction;
Expand Down Expand Up @@ -60,12 +59,14 @@ module.exports = {
// Assigning our stat variables
const { omega, game } = stats;
const { general } = game;
const hoursPlayed = Math.round(omega.playtime / 60 / 60);
const remainingMinutesPlayed = Math.round(omega.playtime % 60);
const daysPlayed = Math.floor(omega.playtime / 86400);
const hoursPlayed = Math.floor(omega.playtime / 3600) % 24;
const minutesPlayed = Math.floor(omega.playtime / 60) % 60;
const secondsPlayed = omega.playtime % 60;
const playSessions = omega.sessions;
const averagePlaytimePerSession = Math.round(
((hoursPlayed * 60)
+ remainingMinutesPlayed)
+ minutesPlayed)
/ playSessions
);
const [
Expand All @@ -89,7 +90,7 @@ module.exports = {
color: colorResolver(),
title: `Stats for ${omega.name_history[0] || 'Survivor'}`,
description: stripIndents`
Survivor has played for ${hoursPlayed} hours and ${remainingMinutesPlayed} minutes over ${playSessions} total sessions.
Survivor has played for ${daysPlayed} days, ${hoursPlayed} hours, ${minutesPlayed} minutes, and ${secondsPlayed} seconds - over ${playSessions} total sessions.
Bringing them to an average of ${!isNaN(averagePlaytimePerSession) ? averagePlaytimePerSession : 'n/a'} minutes per session.
**Name History:** **\`${omega.name_history.slice(0, 10).join('`**, **`') || 'None'}\`**
Expand Down

0 comments on commit 3fe37ad

Please sign in to comment.