From 883cd594978882d8fc7df5cc91bee4105548091d Mon Sep 17 00:00:00 2001 From: codefactor-io Date: Thu, 3 Mar 2022 20:32:00 +0000 Subject: [PATCH] [CodeFactor] Apply fixes to commit 2e12fe3 --- src/commands/credits/addons/top.js | 4 +--- src/commands/credits/index.js | 15 ++++++++++----- src/helpers/creditNoun.js | 4 +--- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/commands/credits/addons/top.js b/src/commands/credits/addons/top.js index 012508d..f7e230e 100644 --- a/src/commands/credits/addons/top.js +++ b/src/commands/credits/addons/top.js @@ -6,9 +6,7 @@ module.exports = async (interaction) => { await credits.find().then(async (data) => { const topTen = data.sort((a, b) => (a.balance > b.balance ? -1 : 1)).slice(0, 10); - const item = (x, index) => { - return `**Top ${index + 1}** - <@${x.userId}> ${creditNoun(x.balance)}`; - }; + const item = (x, index) => `**Top ${index + 1}** - <@${x.userId}> ${creditNoun(x.balance)}`; const embed = { title: 'Balance Top', diff --git a/src/commands/credits/index.js b/src/commands/credits/index.js index 6baac7b..0fa9b20 100644 --- a/src/commands/credits/index.js +++ b/src/commands/credits/index.js @@ -79,15 +79,20 @@ module.exports = { async execute(interaction) { if (interaction.options.getSubcommand() === 'balance') { await balance(interaction); - } else if (interaction.options.getSubcommand() === 'gift') { + } + else if (interaction.options.getSubcommand() === 'gift') { await gift(interaction); - } else if (interaction.options.getSubcommand() === 'give') { + } + else if (interaction.options.getSubcommand() === 'give') { await give(interaction); - } else if (interaction.options.getSubcommand() === 'redeem') { + } + else if (interaction.options.getSubcommand() === 'redeem') { await redeem(interaction); - } else if (interaction.options.getSubcommand() === 'take') { + } + else if (interaction.options.getSubcommand() === 'take') { await take(interaction); - } else if (interaction.options.getSubcommand() === 'top') { + } + else if (interaction.options.getSubcommand() === 'top') { await top(interaction); } }, diff --git a/src/helpers/creditNoun.js b/src/helpers/creditNoun.js index 9b58d78..caadc51 100644 --- a/src/helpers/creditNoun.js +++ b/src/helpers/creditNoun.js @@ -1,3 +1 @@ -module.exports = (amount) => { - return `${amount <= 1 ? `${amount} credit` : `${amount} credits`}`; -}; +module.exports = (amount) => `${amount <= 1 ? `${amount} credit` : `${amount} credits`}`;