diff --git a/.eslintrc.json b/.eslintrc.json index 411492a..111cbbc 100755 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -5,12 +5,8 @@ "es2021": true, "node": true }, - "plugins": [ - "sonarjs" - ], "extends": [ - "eslint:recommended", - "plugin:sonarjs/recommended" + "eslint:recommended" ], "parserOptions": { "ecmaVersion": "latest", diff --git a/package-lock.json b/package-lock.json index 434a947..c2ce68e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,6 @@ }, "devDependencies": { "eslint": "^8.15.0", - "eslint-plugin-sonarjs": "^0.13.0", "nodemon": "^2.0.16" }, "engines": { @@ -880,18 +879,6 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint-plugin-sonarjs": { - "version": "0.13.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-sonarjs/-/eslint-plugin-sonarjs-0.13.0.tgz", - "integrity": "sha512-t3m7ta0EspzDxSOZh3cEOJIJVZgN/TlJYaBGnQlK6W/PZNbWep8q4RQskkJkA7/zwNpX0BaoEOSUUrqaADVoqA==", - "dev": true, - "engines": { - "node": ">=12" - }, - "peerDependencies": { - "eslint": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" - } - }, "node_modules/eslint-scope": { "version": "7.1.1", "dev": true, @@ -3115,13 +3102,6 @@ "v8-compile-cache": "^2.0.3" } }, - "eslint-plugin-sonarjs": { - "version": "0.13.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-sonarjs/-/eslint-plugin-sonarjs-0.13.0.tgz", - "integrity": "sha512-t3m7ta0EspzDxSOZh3cEOJIJVZgN/TlJYaBGnQlK6W/PZNbWep8q4RQskkJkA7/zwNpX0BaoEOSUUrqaADVoqA==", - "dev": true, - "requires": {} - }, "eslint-scope": { "version": "7.1.1", "dev": true, diff --git a/package.json b/package.json index 4e20ffb..32d6a13 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,6 @@ }, "devDependencies": { "eslint": "^8.15.0", - "eslint-plugin-sonarjs": "^0.13.0", "nodemon": "^2.0.16" }, "repository": { diff --git a/src/commands/dayz/stats.js b/src/commands/dayz/stats.js index aed5904..b6441ca 100644 --- a/src/commands/dayz/stats.js +++ b/src/commands/dayz/stats.js @@ -27,7 +27,6 @@ module.exports = { } }, - // eslint-disable-next-line sonarjs/cognitive-complexity run: async ({ client, interaction }) => { // Destructuring and assignments const { options } = interaction; @@ -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 [ @@ -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'}\`**