From 21fc633a658a14427f093fcc5a14ba6528cd90ce Mon Sep 17 00:00:00 2001 From: codefactor-io Date: Sun, 10 Apr 2022 21:17:39 +0000 Subject: [PATCH] [CodeFactor] Apply fixes to commit 0b6ccc9 --- src/commands/admin/credits/modules/give.ts | 28 ++++++++-------- src/commands/admin/credits/modules/set.ts | 24 +++++++------- src/commands/admin/credits/modules/take.ts | 28 ++++++++-------- .../admin/credits/modules/transfer.ts | 32 +++++++++---------- 4 files changed, 56 insertions(+), 56 deletions(-) diff --git a/src/commands/admin/credits/modules/give.ts b/src/commands/admin/credits/modules/give.ts index 5d0ec4b..e220ced 100644 --- a/src/commands/admin/credits/modules/give.ts +++ b/src/commands/admin/credits/modules/give.ts @@ -1,17 +1,17 @@ // Dependencies -import { CommandInteraction, ColorResolvable } from 'discord.js'; +import { CommandInteraction, ColorResolvable } from "discord.js"; // Configurations -import config from '../../../../../config.json'; +import config from "../../../../../config.json"; // Handlers -import logger from '../../../../handlers/logger'; +import logger from "../../../../handlers/logger"; // Helpers -import creditNoun from '../../../../helpers/creditNoun'; +import creditNoun from "../../../../helpers/creditNoun"; // Models -import fetchUser from '../../../../helpers/fetchUser'; +import fetchUser from "../../../../helpers/fetchUser"; // Function export default async (interaction: CommandInteraction) => { @@ -19,17 +19,17 @@ export default async (interaction: CommandInteraction) => { const { guild, user, options } = interaction; // User option - const optionUser = options?.getUser('user'); + const optionUser = options?.getUser("user"); // Amount option - const optionAmount = options?.getInteger('amount'); + const optionAmount = options?.getInteger("amount"); // If amount option is null if (optionAmount === null) { // Embed object const embed = { - title: ':toolbox: Admin - Credits [Give]' as string, - description: 'We could not read your requested amount.' as string, + title: ":toolbox: Admin - Credits [Give]" as string, + description: "We could not read your requested amount." as string, color: config?.colors?.error as ColorResolvable, timestamp: new Date(), footer: { @@ -46,8 +46,8 @@ export default async (interaction: CommandInteraction) => { if (optionAmount <= 0) { // Embed object const embed = { - title: ':toolbox: Admin - Credits [Give]' as string, - description: 'You can not give zero credits or below.' as string, + title: ":toolbox: Admin - Credits [Give]" as string, + description: "You can not give zero credits or below." as string, color: config?.colors?.error as ColorResolvable, timestamp: new Date(), footer: { @@ -70,7 +70,7 @@ export default async (interaction: CommandInteraction) => { if (!toUser) { // Embed object const embed = { - title: ':toolbox: Admin - Credits [Give]' as string, + title: ":toolbox: Admin - Credits [Give]" as string, description: `We could not find ${optionUser} in our database.`, color: config?.colors?.error as ColorResolvable, timestamp: new Date(), @@ -88,7 +88,7 @@ export default async (interaction: CommandInteraction) => { if (toUser?.credits === null) { // Embed object const embed = { - title: ':toolbox: Admin - Credits [Give]' as string, + title: ":toolbox: Admin - Credits [Give]" as string, description: `We could not find credits for ${optionUser} in our database.`, color: config?.colors?.error as ColorResolvable, timestamp: new Date(), @@ -109,7 +109,7 @@ export default async (interaction: CommandInteraction) => { await toUser?.save()?.then(async () => { // Embed object const embed = { - title: ':toolbox: Admin - Credits [Give]' as string, + title: ":toolbox: Admin - Credits [Give]" as string, description: `We have given ${optionUser}, ${creditNoun(optionAmount)}.`, color: config?.colors?.success as ColorResolvable, timestamp: new Date(), diff --git a/src/commands/admin/credits/modules/set.ts b/src/commands/admin/credits/modules/set.ts index ca67a61..c39b4f9 100644 --- a/src/commands/admin/credits/modules/set.ts +++ b/src/commands/admin/credits/modules/set.ts @@ -1,17 +1,17 @@ // Dependencies -import { CommandInteraction, ColorResolvable } from 'discord.js'; +import { CommandInteraction, ColorResolvable } from "discord.js"; // Configurations -import config from '../../../../../config.json'; +import config from "../../../../../config.json"; // Handlers -import logger from '../../../../handlers/logger'; +import logger from "../../../../handlers/logger"; // Helpers -import creditNoun from '../../../../helpers/creditNoun'; +import creditNoun from "../../../../helpers/creditNoun"; // Models -import fetchUser from '../../../../helpers/fetchUser'; +import fetchUser from "../../../../helpers/fetchUser"; // Function export default async (interaction: CommandInteraction) => { @@ -19,17 +19,17 @@ export default async (interaction: CommandInteraction) => { const { options, user, guild } = interaction; // User Option - const optionUser = options.getUser('user'); + const optionUser = options.getUser("user"); // Amount Option - const optionAmount = options.getInteger('amount'); + const optionAmount = options.getInteger("amount"); // If amount is null if (optionAmount === null) { // Embed object const embed = { - title: ':toolbox: Admin - Credits [Set]' as string, - description: 'We could not read your requested amount.' as string, + title: ":toolbox: Admin - Credits [Set]" as string, + description: "We could not read your requested amount." as string, color: config?.colors?.error as ColorResolvable, timestamp: new Date(), footer: { @@ -52,7 +52,7 @@ export default async (interaction: CommandInteraction) => { if (!toUser) { // Embed object const embed = { - title: ':toolbox: Admin - Credits [Set]' as string, + title: ":toolbox: Admin - Credits [Set]" as string, description: `We could not find ${optionUser} in our database.`, color: config?.colors?.error as ColorResolvable, timestamp: new Date(), @@ -70,7 +70,7 @@ export default async (interaction: CommandInteraction) => { if (toUser?.credits === null) { // Embed object const embed = { - title: ':toolbox: Admin - Credits [Set]' as string, + title: ":toolbox: Admin - Credits [Set]" as string, description: `We could not find credits for ${optionUser} in our database.`, color: config?.colors?.error as ColorResolvable, timestamp: new Date(), @@ -91,7 +91,7 @@ export default async (interaction: CommandInteraction) => { await toUser?.save()?.then(async () => { // Embed object const embed = { - title: ':toolbox: Admin - Credits [Set]' as string, + title: ":toolbox: Admin - Credits [Set]" as string, description: `We have set ${optionUser} to ${creditNoun(optionAmount)}`, color: config?.colors?.success as ColorResolvable, timestamp: new Date(), diff --git a/src/commands/admin/credits/modules/take.ts b/src/commands/admin/credits/modules/take.ts index b1274c1..fb41159 100644 --- a/src/commands/admin/credits/modules/take.ts +++ b/src/commands/admin/credits/modules/take.ts @@ -1,17 +1,17 @@ // Dependencies -import { CommandInteraction, ColorResolvable } from 'discord.js'; +import { CommandInteraction, ColorResolvable } from "discord.js"; // Configurations -import config from '../../../../../config.json'; +import config from "../../../../../config.json"; // Handlers -import logger from '../../../../handlers/logger'; +import logger from "../../../../handlers/logger"; // Helpers -import creditNoun from '../../../../helpers/creditNoun'; +import creditNoun from "../../../../helpers/creditNoun"; // Models -import fetchUser from '../../../../helpers/fetchUser'; +import fetchUser from "../../../../helpers/fetchUser"; // Function export default async (interaction: CommandInteraction) => { @@ -19,17 +19,17 @@ export default async (interaction: CommandInteraction) => { const { guild, user, options } = interaction; // User option - const optionUser = options?.getUser('user'); + const optionUser = options?.getUser("user"); // Amount option - const optionAmount = options?.getInteger('amount'); + const optionAmount = options?.getInteger("amount"); // If amount is null if (optionAmount === null) { // Embed object const embed = { - title: ':toolbox: Admin - Credits [Take]' as string, - description: 'We could not read your requested amount.' as string, + title: ":toolbox: Admin - Credits [Take]" as string, + description: "We could not read your requested amount." as string, color: config?.colors?.error as ColorResolvable, timestamp: new Date(), footer: { @@ -46,8 +46,8 @@ export default async (interaction: CommandInteraction) => { if (optionAmount <= 0) { // Embed object const embed = { - title: ':toolbox: Admin - Credits [Take]' as string, - description: 'You can not take zero credits or below.' as string, + title: ":toolbox: Admin - Credits [Take]" as string, + description: "You can not take zero credits or below." as string, color: config?.colors?.error as ColorResolvable, timestamp: new Date(), footer: { @@ -70,7 +70,7 @@ export default async (interaction: CommandInteraction) => { if (!toUser) { // Embed object const embed = { - title: ':toolbox: Admin - Credits [Take]' as string, + title: ":toolbox: Admin - Credits [Take]" as string, description: `We could not find ${optionUser} in our database.`, color: config?.colors?.error as ColorResolvable, timestamp: new Date(), @@ -88,7 +88,7 @@ export default async (interaction: CommandInteraction) => { if (toUser?.credits === null) { // Embed object const embed = { - title: ':toolbox: Admin - Credits [Take]' as string, + title: ":toolbox: Admin - Credits [Take]" as string, description: `We could not find credits for ${optionUser} in our database.`, color: config?.colors?.error as ColorResolvable, timestamp: new Date(), @@ -109,7 +109,7 @@ export default async (interaction: CommandInteraction) => { await toUser?.save()?.then(async () => { // Embed object const embed = { - title: ':toolbox: Admin - Credits [Set]' as string, + title: ":toolbox: Admin - Credits [Set]" as string, description: `We have taken ${creditNoun( optionAmount )} from ${optionUser}`, diff --git a/src/commands/admin/credits/modules/transfer.ts b/src/commands/admin/credits/modules/transfer.ts index ed66b63..9e6ba15 100644 --- a/src/commands/admin/credits/modules/transfer.ts +++ b/src/commands/admin/credits/modules/transfer.ts @@ -1,18 +1,18 @@ // Dependencies -import { CommandInteraction, ColorResolvable } from 'discord.js'; +import { CommandInteraction, ColorResolvable } from "discord.js"; // Configurations -import config from '../../../../../config.json'; +import config from "../../../../../config.json"; // Handlers -import logger from '../../../../handlers/logger'; +import logger from "../../../../handlers/logger"; // Helpers -import creditNoun from '../../../../helpers/creditNoun'; -import saveUser from '../../../../helpers/saveUser'; +import creditNoun from "../../../../helpers/creditNoun"; +import saveUser from "../../../../helpers/saveUser"; // Models -import fetchUser from '../../../../helpers/fetchUser'; +import fetchUser from "../../../../helpers/fetchUser"; // Function export default async (interaction: CommandInteraction) => { @@ -20,16 +20,16 @@ export default async (interaction: CommandInteraction) => { const { guild, options, user } = interaction; // Get options - const optionFromUser = options?.getUser('from'); - const optionToUser = options?.getUser('to'); - const optionAmount = options?.getInteger('amount'); + const optionFromUser = options?.getUser("from"); + const optionToUser = options?.getUser("to"); + const optionAmount = options?.getInteger("amount"); // If amount is null if (optionAmount === null) { // Embed object const embed = { - title: ':toolbox: Admin - Credits [Transfer]' as string, - description: 'We could not read your requested amount.' as string, + title: ":toolbox: Admin - Credits [Transfer]" as string, + description: "We could not read your requested amount." as string, color: config?.colors?.error as ColorResolvable, timestamp: new Date(), footer: { @@ -56,7 +56,7 @@ export default async (interaction: CommandInteraction) => { if (!fromUser) { // Embed object const embed = { - title: ':toolbox: Admin - Credits [Transfer]' as string, + title: ":toolbox: Admin - Credits [Transfer]" as string, description: `We could not find ${optionFromUser} in our database.`, color: config?.colors?.error as ColorResolvable, timestamp: new Date(), @@ -74,7 +74,7 @@ export default async (interaction: CommandInteraction) => { if (!fromUser?.credits) { // Embed object const embed = { - title: ':toolbox: Admin - Credits [Transfer]' as string, + title: ":toolbox: Admin - Credits [Transfer]" as string, description: `We could not find credits for ${optionFromUser} in our database.`, color: config?.colors?.error as ColorResolvable, timestamp: new Date(), @@ -92,7 +92,7 @@ export default async (interaction: CommandInteraction) => { if (!toUser) { // Embed object const embed = { - title: ':toolbox: Admin - Credits [Transfer]' as string, + title: ":toolbox: Admin - Credits [Transfer]" as string, description: `We could not find ${optionToUser} in our database.`, color: config?.colors?.error as ColorResolvable, timestamp: new Date(), @@ -110,7 +110,7 @@ export default async (interaction: CommandInteraction) => { if (toUser?.credits === null) { // Embed object const embed = { - title: ':toolbox: Admin - Credits [Transfer]' as string, + title: ":toolbox: Admin - Credits [Transfer]" as string, description: `We could not find credits for ${optionToUser} in our database.`, color: config?.colors?.error as ColorResolvable, timestamp: new Date(), @@ -134,7 +134,7 @@ export default async (interaction: CommandInteraction) => { await saveUser(fromUser, toUser)?.then(async () => { // Embed object const embed = { - title: ':toolbox: Admin - Credits [Transfer]' as string, + title: ":toolbox: Admin - Credits [Transfer]" as string, description: `You sent ${creditNoun( optionAmount )} from ${optionFromUser} to ${optionToUser}.`,