From 99ecab3af835723222c8c96bc6accaa547203197 Mon Sep 17 00:00:00 2001 From: Vermium Sifell Date: Sun, 10 Apr 2022 23:13:21 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=91=20admin=20commands=20wasnt=20worki?= =?UTF-8?q?ng?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/commands/admin/credits/modules/give.ts | 30 ++++++++-------- src/commands/admin/credits/modules/set.ts | 26 +++++++------- src/commands/admin/credits/modules/take.ts | 30 ++++++++-------- .../admin/credits/modules/transfer.ts | 34 +++++++++---------- 4 files changed, 60 insertions(+), 60 deletions(-) diff --git a/src/commands/admin/credits/modules/give.ts b/src/commands/admin/credits/modules/give.ts index caaa967..5d0ec4b 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(), @@ -85,10 +85,10 @@ export default async (interaction: CommandInteraction) => { } // If toUser.credits does not exist - if (!toUser?.credits) { + 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 2321680..ca67a61 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(), @@ -67,10 +67,10 @@ export default async (interaction: CommandInteraction) => { } // If toUser.credits does not exist - if (!toUser?.credits) { + 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 08dae69..b1274c1 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(), @@ -85,10 +85,10 @@ export default async (interaction: CommandInteraction) => { } // If toUser.credits does not exist - if (!toUser?.credits) { + 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 e981b62..ed66b63 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(), @@ -107,10 +107,10 @@ export default async (interaction: CommandInteraction) => { } // If toUser.credits does not exist - if (!toUser?.credits) { + 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}.`,