From 470e8ce45ec11395ba2bd2e0383e4b2d35778399 Mon Sep 17 00:00:00 2001 From: Vermium Sifell Date: Sun, 10 Apr 2022 22:08:03 +0200 Subject: [PATCH 1/7] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20code=20?= =?UTF-8?q?smell=20fixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/commands/admin/counters/modules/add.ts | 26 ++++++++++------------ 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/commands/admin/counters/modules/add.ts b/src/commands/admin/counters/modules/add.ts index c19514f..a058d09 100644 --- a/src/commands/admin/counters/modules/add.ts +++ b/src/commands/admin/counters/modules/add.ts @@ -1,14 +1,14 @@ // Dependencies -import { ColorResolvable, CommandInteraction } from "discord.js"; +import { ColorResolvable, CommandInteraction } 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'; // Models -import counterSchema from "../../../../helpers/database/models/counterSchema"; +import counterSchema from '../../../../helpers/database/models/counterSchema'; // Function export default async (interaction: CommandInteraction) => { @@ -16,20 +16,19 @@ export default async (interaction: CommandInteraction) => { const { options, guild, user } = interaction; // Channel option - const optionChannel = options?.getChannel("channel"); + const optionChannel = options?.getChannel('channel'); // Word option - const optionWord = options?.getString("word"); + const optionWord = options?.getString('word'); // Start option - const optionStart = options?.getNumber("start"); + const optionStart = options?.getNumber('start'); - if (optionChannel?.type !== "GUILD_TEXT") { - // Embed object + if (optionChannel?.type !== 'GUILD_TEXT') { const embed = { - title: ":toolbox: Admin - Counters [Add]" as string, + title: ':toolbox: Admin - Counters [Add]' as string, description: - "That channel is not supported, it needs to be a text channel." as string, + 'That channel is not supported, it needs to be a text channel.' as string, timestamp: new Date() as Date, color: config?.colors?.error as ColorResolvable, footer: { @@ -56,9 +55,8 @@ export default async (interaction: CommandInteraction) => { counter: optionStart || 0, }); - // Embed object const embed = { - title: ":toolbox: Admin - Counters [Add]" as string, + title: ':toolbox: Admin - Counters [Add]' as string, description: `${optionChannel} is now counting when hearing word ${optionWord} and it starts at number ${ optionStart || 0 @@ -82,7 +80,7 @@ export default async (interaction: CommandInteraction) => { // Embed object const embed = { - title: ":toolbox: Admin - Counters [Add]" as string, + title: ':toolbox: Admin - Counters [Add]' as string, description: `${optionChannel} is already a counting channel.` as string, timestamp: new Date() as Date, color: config?.colors?.error as ColorResolvable, From d73a9c10f8b0ff47638c379f6866a4b494d8f9bf Mon Sep 17 00:00:00 2001 From: Vermium Sifell Date: Sun, 10 Apr 2022 22:10:27 +0200 Subject: [PATCH 2/7] =?UTF-8?q?=F0=9F=8E=A8=20code=20smells=20fixed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/commands/admin/counters/modules/add.ts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/commands/admin/counters/modules/add.ts b/src/commands/admin/counters/modules/add.ts index a058d09..588a77a 100644 --- a/src/commands/admin/counters/modules/add.ts +++ b/src/commands/admin/counters/modules/add.ts @@ -29,7 +29,7 @@ export default async (interaction: CommandInteraction) => { title: ':toolbox: Admin - Counters [Add]' as string, description: 'That channel is not supported, it needs to be a text channel.' as string, - timestamp: new Date() as Date, + timestamp: new Date(), color: config?.colors?.error as ColorResolvable, footer: { iconURL: config?.footer?.icon as string, @@ -38,7 +38,7 @@ export default async (interaction: CommandInteraction) => { }; // Return interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); } const counterExist = await counterSchema?.findOne({ @@ -57,11 +57,10 @@ export default async (interaction: CommandInteraction) => { const embed = { title: ':toolbox: Admin - Counters [Add]' as string, - description: - `${optionChannel} is now counting when hearing word ${optionWord} and it starts at number ${ - optionStart || 0 - }.` as string, - timestamp: new Date() as Date, + description: `${optionChannel} is now counting when hearing word ${optionWord} and it starts at number ${ + optionStart || 0 + }.`, + timestamp: new Date(), color: config?.colors?.success as ColorResolvable, footer: { iconURL: config?.footer?.icon as string, @@ -81,8 +80,8 @@ export default async (interaction: CommandInteraction) => { // Embed object const embed = { title: ':toolbox: Admin - Counters [Add]' as string, - description: `${optionChannel} is already a counting channel.` as string, - timestamp: new Date() as Date, + description: `${optionChannel} is already a counting channel.`, + timestamp: new Date(), color: config?.colors?.error as ColorResolvable, footer: { iconURL: config?.footer?.icon as string, From 82e12ff10a27554962f880c10b17e8e1753f6c95 Mon Sep 17 00:00:00 2001 From: codefactor-io Date: Sun, 10 Apr 2022 20:10:54 +0000 Subject: [PATCH 3/7] [CodeFactor] Apply fixes --- src/commands/admin/counters/modules/add.ts | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/commands/admin/counters/modules/add.ts b/src/commands/admin/counters/modules/add.ts index 588a77a..fa557b0 100644 --- a/src/commands/admin/counters/modules/add.ts +++ b/src/commands/admin/counters/modules/add.ts @@ -1,14 +1,14 @@ // Dependencies -import { ColorResolvable, CommandInteraction } from 'discord.js'; +import { ColorResolvable, CommandInteraction } 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"; // Models -import counterSchema from '../../../../helpers/database/models/counterSchema'; +import counterSchema from "../../../../helpers/database/models/counterSchema"; // Function export default async (interaction: CommandInteraction) => { @@ -16,19 +16,19 @@ export default async (interaction: CommandInteraction) => { const { options, guild, user } = interaction; // Channel option - const optionChannel = options?.getChannel('channel'); + const optionChannel = options?.getChannel("channel"); // Word option - const optionWord = options?.getString('word'); + const optionWord = options?.getString("word"); // Start option - const optionStart = options?.getNumber('start'); + const optionStart = options?.getNumber("start"); - if (optionChannel?.type !== 'GUILD_TEXT') { + if (optionChannel?.type !== "GUILD_TEXT") { const embed = { - title: ':toolbox: Admin - Counters [Add]' as string, + title: ":toolbox: Admin - Counters [Add]" as string, description: - 'That channel is not supported, it needs to be a text channel.' as string, + "That channel is not supported, it needs to be a text channel." as string, timestamp: new Date(), color: config?.colors?.error as ColorResolvable, footer: { @@ -56,7 +56,7 @@ export default async (interaction: CommandInteraction) => { }); const embed = { - title: ':toolbox: Admin - Counters [Add]' as string, + title: ":toolbox: Admin - Counters [Add]" as string, description: `${optionChannel} is now counting when hearing word ${optionWord} and it starts at number ${ optionStart || 0 }.`, @@ -79,7 +79,7 @@ export default async (interaction: CommandInteraction) => { // Embed object const embed = { - title: ':toolbox: Admin - Counters [Add]' as string, + title: ":toolbox: Admin - Counters [Add]" as string, description: `${optionChannel} is already a counting channel.`, timestamp: new Date(), color: config?.colors?.error as ColorResolvable, From 47b9d4f85cfc5531788e30d3ae3f9ebed9875045 Mon Sep 17 00:00:00 2001 From: Vermium Sifell Date: Sun, 10 Apr 2022 22:12:30 +0200 Subject: [PATCH 4/7] =?UTF-8?q?=F0=9F=8E=A8=20code=20smells=20fixed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/commands/admin/counters/index.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/commands/admin/counters/index.ts b/src/commands/admin/counters/index.ts index ea02b38..24ab5e2 100644 --- a/src/commands/admin/counters/index.ts +++ b/src/commands/admin/counters/index.ts @@ -1,12 +1,12 @@ // Dependencies -import { CommandInteraction } from "discord.js"; +import { CommandInteraction } from 'discord.js'; // Handlers -import logger from "../../../handlers/logger"; +import logger from '../../../handlers/logger'; // Modules -import add from "./modules/add"; -import remove from "./modules/remove"; +import add from './modules/add'; +import remove from './modules/remove'; // Function export default async (interaction: CommandInteraction) => { @@ -14,15 +14,15 @@ export default async (interaction: CommandInteraction) => { const { options, guild, user, commandName } = interaction; // Module - Add - if (options?.getSubcommand() === "add") { + if (options?.getSubcommand() === 'add') { // Execute Module - Add - return await add(interaction); + return add(interaction); } // Module - Remove - else if (options?.getSubcommand() === "remove") { + else if (options?.getSubcommand() === 'remove') { // Execute Module - Remove - return await remove(interaction); + return remove(interaction); } // Log debug message From bcd68523101a5f236adf9ed729754a960e3b4560 Mon Sep 17 00:00:00 2001 From: Vermium Sifell Date: Sun, 10 Apr 2022 22:13:13 +0200 Subject: [PATCH 5/7] =?UTF-8?q?=F0=9F=8E=A8=20code=20smells=20fixed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/commands/admin/counters/modules/remove.ts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/commands/admin/counters/modules/remove.ts b/src/commands/admin/counters/modules/remove.ts index 9664b7c..720c170 100644 --- a/src/commands/admin/counters/modules/remove.ts +++ b/src/commands/admin/counters/modules/remove.ts @@ -1,14 +1,14 @@ // Dependencies -import { ColorResolvable, CommandInteraction } from "discord.js"; +import { ColorResolvable, CommandInteraction } 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'; // Models -import counterSchema from "../../../../helpers/database/models/counterSchema"; +import counterSchema from '../../../../helpers/database/models/counterSchema'; // Function export default async (interaction: CommandInteraction) => { @@ -16,7 +16,7 @@ export default async (interaction: CommandInteraction) => { const { options, guild, user } = interaction; // Get options - const optionChannel = options?.getChannel("channel"); + const optionChannel = options?.getChannel('channel'); await counterSchema ?.deleteOne({ @@ -26,10 +26,9 @@ export default async (interaction: CommandInteraction) => { ?.then(async () => { // Embed object const embed = { - title: ":toolbox: Admin - Counters [Remove]" as string, - description: - `${optionChannel} is no longer an counting channel.` as string, - timestamp: new Date() as Date, + title: ':toolbox: Admin - Counters [Remove]' as string, + description: `${optionChannel} is no longer an counting channel.`, + timestamp: new Date(), color: config?.colors?.success as ColorResolvable, footer: { iconURL: config?.footer?.icon as string, From 41832827ebe43bca4d4c4e6aa69190836411046e Mon Sep 17 00:00:00 2001 From: Vermium Sifell Date: Sun, 10 Apr 2022 22:19:45 +0200 Subject: [PATCH 6/7] =?UTF-8?q?=F0=9F=8E=A8=20admin=20commands=20code=20sm?= =?UTF-8?q?ells=20fixed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/commands/admin/credits/index.ts | 28 ++--- src/commands/admin/credits/modules/give.ts | 57 +++++---- src/commands/admin/credits/modules/set.ts | 49 ++++---- src/commands/admin/credits/modules/take.ts | 55 +++++---- .../admin/credits/modules/transfer.ts | 70 ++++++----- src/commands/admin/index.ts | 112 +++++++++--------- src/commands/counters/index.ts | 24 ++-- src/commands/counters/modules/view.ts | 20 ++-- src/commands/credits/index.ts | 58 ++++----- src/commands/credits/modules/balance.ts | 28 ++--- src/commands/credits/modules/gift.ts | 64 +++++----- src/commands/credits/modules/top.ts | 16 +-- src/commands/credits/modules/work.ts | 34 +++--- src/commands/profile/index.ts | 24 ++-- src/commands/profile/modules/view.ts | 22 ++-- src/commands/reputation/modules/give.ts | 44 +++---- src/commands/settings/guild/addons/credits.ts | 40 +++---- src/commands/settings/guild/addons/points.ts | 32 ++--- .../settings/guild/addons/pterodactyl.ts | 20 ++-- src/commands/settings/guild/index.ts | 32 ++--- .../settings/user/modules/appearance.ts | 20 ++-- src/commands/shop/index.ts | 50 ++++---- src/commands/shop/modules/pterodactyl.ts | 74 ++++++------ src/commands/shop/roles/modules/buy.ts | 30 ++--- src/commands/shop/roles/modules/cancel.ts | 26 ++-- src/commands/utilities/index.ts | 40 +++---- src/commands/utilities/modules/about.ts | 8 +- src/commands/utilities/modules/lookup.ts | 70 +++++------ src/commands/utilities/modules/stats.ts | 20 ++-- 29 files changed, 578 insertions(+), 589 deletions(-) diff --git a/src/commands/admin/credits/index.ts b/src/commands/admin/credits/index.ts index e3a8c3d..54a260b 100644 --- a/src/commands/admin/credits/index.ts +++ b/src/commands/admin/credits/index.ts @@ -1,38 +1,38 @@ // Dependencies -import { CommandInteraction } from "discord.js"; +import { CommandInteraction } from 'discord.js'; // Modules -import give from "./modules/give"; -import take from "./modules/take"; -import set from "./modules/set"; -import transfer from "./modules/transfer"; +import give from './modules/give'; +import take from './modules/take'; +import set from './modules/set'; +import transfer from './modules/transfer'; // Function export default async (interaction: CommandInteraction) => { // Destructure - const { user, guild, commandName, options } = interaction; + const { options } = interaction; // Module - Give - if (options?.getSubcommand() === "give") { + if (options?.getSubcommand() === 'give') { // Execute Module - Give - return await give(interaction); + return give(interaction); } // Module - Take - else if (options?.getSubcommand() === "take") { + else if (options?.getSubcommand() === 'take') { // Execute Module - Take - return await take(interaction); + return take(interaction); } // Module - Set - else if (options?.getSubcommand() === "set") { + else if (options?.getSubcommand() === 'set') { // Execute Module - Set - return await set(interaction); + return set(interaction); } // Module - Transfer - else if (options?.getSubcommand() === "transfer") { + else if (options?.getSubcommand() === 'transfer') { // Execute Module - Transfer - return await transfer(interaction); + return transfer(interaction); } }; diff --git a/src/commands/admin/credits/modules/give.ts b/src/commands/admin/credits/modules/give.ts index 4be1936..5d1f515 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,19 +19,19 @@ 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() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -39,17 +39,17 @@ export default async (interaction: CommandInteraction) => { }; // Return interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); } // If amount is zero or below 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() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -57,7 +57,7 @@ export default async (interaction: CommandInteraction) => { }; // Return interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); } if (optionUser === null) return; @@ -70,10 +70,10 @@ export default async (interaction: CommandInteraction) => { if (!toUser) { // Embed object const embed = { - title: ":toolbox: Admin - Credits [Give]" as string, - description: `We could not find ${optionUser} in our database.` 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() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -81,18 +81,17 @@ export default async (interaction: CommandInteraction) => { }; // Return interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); } // If toUser.credits does not exist if (!toUser?.credits) { // Embed object const embed = { - title: ":toolbox: Admin - Credits [Give]" as string, - description: - `We could not find credits for ${optionUser} in our database.` 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() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -100,7 +99,7 @@ export default async (interaction: CommandInteraction) => { }; // Return interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); } // Deposit amount to toUser @@ -110,12 +109,10 @@ export default async (interaction: CommandInteraction) => { await toUser?.save()?.then(async () => { // Embed object const embed = { - title: ":toolbox: Admin - Credits [Give]" as string, - description: `We have given ${optionUser}, ${creditNoun( - optionAmount - )}.` 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() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -130,6 +127,6 @@ export default async (interaction: CommandInteraction) => { ); // Return interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); }); }; diff --git a/src/commands/admin/credits/modules/set.ts b/src/commands/admin/credits/modules/set.ts index f12ae53..e935c15 100644 --- a/src/commands/admin/credits/modules/set.ts +++ b/src/commands/admin/credits/modules/set.ts @@ -1,17 +1,17 @@ // Dependencies -import { Permissions, 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,19 +19,19 @@ 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() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -39,7 +39,7 @@ export default async (interaction: CommandInteraction) => { }; // Send interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); } if (optionUser === null) return; @@ -52,10 +52,10 @@ export default async (interaction: CommandInteraction) => { if (!toUser) { // Embed object const embed = { - title: ":toolbox: Admin - Credits [Set]" as string, - description: `We could not find ${optionUser} in our database.` 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() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -63,18 +63,17 @@ export default async (interaction: CommandInteraction) => { }; // Return interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); } // If toUser.credits does not exist if (!toUser?.credits) { // Embed object const embed = { - title: ":toolbox: Admin - Credits [Set]" as string, - description: - `We could not find credits for ${optionUser} in our database.` 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() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -82,7 +81,7 @@ export default async (interaction: CommandInteraction) => { }; // Return interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); } // Set toUser with amount @@ -92,12 +91,10 @@ export default async (interaction: CommandInteraction) => { await toUser?.save()?.then(async () => { // Embed object const embed = { - title: ":toolbox: Admin - Credits [Set]" as string, - description: `We have set ${optionUser} to ${creditNoun( - optionAmount - )}` 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() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -112,6 +109,6 @@ export default async (interaction: CommandInteraction) => { ); // Return interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); }); }; diff --git a/src/commands/admin/credits/modules/take.ts b/src/commands/admin/credits/modules/take.ts index 75321f1..b43b21b 100644 --- a/src/commands/admin/credits/modules/take.ts +++ b/src/commands/admin/credits/modules/take.ts @@ -1,17 +1,17 @@ // Dependencies -import { Permissions, 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,19 +19,19 @@ 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() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -39,17 +39,17 @@ export default async (interaction: CommandInteraction) => { }; // Send interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); } // If amount is zero or below 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() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -57,7 +57,7 @@ export default async (interaction: CommandInteraction) => { }; // Return interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); } if (optionUser === null) return; @@ -70,10 +70,10 @@ export default async (interaction: CommandInteraction) => { if (!toUser) { // Embed object const embed = { - title: ":toolbox: Admin - Credits [Take]" as string, - description: `We could not find ${optionUser} in our database.` 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() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -81,18 +81,17 @@ export default async (interaction: CommandInteraction) => { }; // Return interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); } // If toUser.credits does not exist if (!toUser?.credits) { // Embed object const embed = { - title: ":toolbox: Admin - Credits [Take]" as string, - description: - `We could not find credits for ${optionUser} in our database.` 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() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -100,7 +99,7 @@ export default async (interaction: CommandInteraction) => { }; // Return interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); } // Withdraw amount from toUser @@ -110,12 +109,12 @@ 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}` as string, + )} from ${optionUser}`, color: config?.colors?.success as ColorResolvable, - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -130,6 +129,6 @@ export default async (interaction: CommandInteraction) => { ); // Return interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); }); }; diff --git a/src/commands/admin/credits/modules/transfer.ts b/src/commands/admin/credits/modules/transfer.ts index d0f4488..6213a42 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,18 +20,18 @@ 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() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -39,7 +39,7 @@ export default async (interaction: CommandInteraction) => { }; // Send interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); } if (guild === null) return; @@ -56,11 +56,10 @@ export default async (interaction: CommandInteraction) => { if (!fromUser) { // Embed object const embed = { - title: ":toolbox: Admin - Credits [Transfer]" as string, - description: - `We could not find ${optionFromUser} in our database.` 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() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -68,18 +67,17 @@ export default async (interaction: CommandInteraction) => { }; // Return interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); } // If toUser.credits does not exist if (!fromUser?.credits) { // Embed object const embed = { - title: ":toolbox: Admin - Credits [Transfer]" as string, - description: - `We could not find credits for ${optionFromUser} in our database.` 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() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -87,18 +85,17 @@ export default async (interaction: CommandInteraction) => { }; // Return interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); } // If toUser does not exist if (!toUser) { // Embed object const embed = { - title: ":toolbox: Admin - Credits [Transfer]" as string, - description: - `We could not find ${optionToUser} in our database.` 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() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -106,18 +103,17 @@ export default async (interaction: CommandInteraction) => { }; // Return interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); } // If toUser.credits does not exist if (!toUser?.credits) { // Embed object const embed = { - title: ":toolbox: Admin - Credits [Transfer]" as string, - description: - `We could not find credits for ${optionToUser} in our database.` 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() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -125,7 +121,7 @@ export default async (interaction: CommandInteraction) => { }; // Return interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); } // Withdraw amount from fromUser @@ -138,10 +134,10 @@ 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}.` as string, + )} from ${optionFromUser} to ${optionToUser}.`, color: config?.colors?.success as ColorResolvable, fields: [ { @@ -155,7 +151,7 @@ export default async (interaction: CommandInteraction) => { inline: true, }, ], - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -170,6 +166,6 @@ export default async (interaction: CommandInteraction) => { ); // Return interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); }); }; diff --git a/src/commands/admin/index.ts b/src/commands/admin/index.ts index ec80e42..369c35f 100644 --- a/src/commands/admin/index.ts +++ b/src/commands/admin/index.ts @@ -1,133 +1,133 @@ //Dependencies -import { SlashCommandBuilder } from "@discordjs/builders"; -import { CommandInteraction, ColorResolvable, Permissions } from "discord.js"; +import { SlashCommandBuilder } from '@discordjs/builders'; +import { CommandInteraction, ColorResolvable, Permissions } 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'; // Groups -import credits from "./credits"; -import counters from "./counters"; +import credits from './credits'; +import counters from './counters'; // Function export default { data: new SlashCommandBuilder() - .setName("admin") - .setDescription("Admin actions.") + .setName('admin') + .setDescription('Admin actions.') .addSubcommandGroup((group) => group - .setName("credits") - .setDescription("Manage credits.") + .setName('credits') + .setDescription('Manage credits.') .addSubcommand((command) => command - .setName("give") - .setDescription("Give credits to a user") + .setName('give') + .setDescription('Give credits to a user') .addUserOption((option) => option - .setName("user") - .setDescription("The user you want to pay.") + .setName('user') + .setDescription('The user you want to pay.') .setRequired(true) ) .addIntegerOption((option) => option - .setName("amount") - .setDescription("The amount you will pay.") + .setName('amount') + .setDescription('The amount you will pay.') .setRequired(true) ) ) .addSubcommand((command) => command - .setName("set") - .setDescription("Set credits to a user") + .setName('set') + .setDescription('Set credits to a user') .addUserOption((option) => option - .setName("user") - .setDescription("The user you want to set credits on.") + .setName('user') + .setDescription('The user you want to set credits on.') .setRequired(true) ) .addIntegerOption((option) => option - .setName("amount") - .setDescription("The amount you will set.") + .setName('amount') + .setDescription('The amount you will set.') .setRequired(true) ) ) .addSubcommand((command) => command - .setName("take") - .setDescription("Take credits from a user") + .setName('take') + .setDescription('Take credits from a user') .addUserOption((option) => option - .setName("user") - .setDescription("The user you want to take credits from.") + .setName('user') + .setDescription('The user you want to take credits from.') .setRequired(true) ) .addIntegerOption((option) => option - .setName("amount") - .setDescription("The amount you will take.") + .setName('amount') + .setDescription('The amount you will take.') .setRequired(true) ) ) .addSubcommand((command) => command - .setName("transfer") - .setDescription("Transfer credits from a user to another user.") + .setName('transfer') + .setDescription('Transfer credits from a user to another user.') .addUserOption((option) => option - .setName("from") - .setDescription("The user you want to take credits from.") + .setName('from') + .setDescription('The user you want to take credits from.') .setRequired(true) ) .addUserOption((option) => option - .setName("to") - .setDescription("The user you want to give credits to.") + .setName('to') + .setDescription('The user you want to give credits to.') .setRequired(true) ) .addIntegerOption((option) => option - .setName("amount") - .setDescription("The amount you will transfer.") + .setName('amount') + .setDescription('The amount you will transfer.') .setRequired(true) ) ) ) .addSubcommandGroup((group) => group - .setName("counters") - .setDescription("Manage counters.") + .setName('counters') + .setDescription('Manage counters.') .addSubcommand((command) => command - .setName("add") - .setDescription("Add a counter") + .setName('add') + .setDescription('Add a counter') .addChannelOption((option) => option - .setName("channel") - .setDescription("The counter channel.") + .setName('channel') + .setDescription('The counter channel.') .setRequired(true) ) .addStringOption((option) => option - .setName("word") - .setDescription("The counter word.") + .setName('word') + .setDescription('The counter word.') .setRequired(true) ) .addNumberOption((option) => - option.setName("start").setDescription("Start at number X.") + option.setName('start').setDescription('Start at number X.') ) ) .addSubcommand((command) => command - .setName("remove") - .setDescription("Remove a counter") + .setName('remove') + .setDescription('Remove a counter') .addChannelOption((option) => option - .setName("channel") - .setDescription("The counter channel.") + .setName('channel') + .setDescription('The counter channel.') .setRequired(true) ) ) @@ -141,10 +141,10 @@ export default { if (!memberPermissions?.has(Permissions?.FLAGS?.MANAGE_GUILD)) { // Embed object const embed = { - title: ":toolbox: Admin" as string, + title: ':toolbox: Admin' as string, color: config?.colors?.error as ColorResolvable, - description: "You do not have permission to manage this!" as string, - timestamp: new Date() as Date, + description: 'You do not have permission to manage this!' as string, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -156,15 +156,15 @@ export default { } // Group - Credits - if (options?.getSubcommandGroup() === "credits") { + if (options?.getSubcommandGroup() === 'credits') { // Execute Group - Credits - return await credits(interaction); + return credits(interaction); } // Group - Counters - else if (options?.getSubcommandGroup() === "counters") { + else if (options?.getSubcommandGroup() === 'counters') { // Execute Group - Counters - return await counters(interaction); + return counters(interaction); } // Send debug message diff --git a/src/commands/counters/index.ts b/src/commands/counters/index.ts index e061089..2efb1f4 100644 --- a/src/commands/counters/index.ts +++ b/src/commands/counters/index.ts @@ -1,26 +1,26 @@ // Dependencies -import { CommandInteraction } from "discord.js"; -import { SlashCommandBuilder } from "@discordjs/builders"; +import { CommandInteraction } from 'discord.js'; +import { SlashCommandBuilder } from '@discordjs/builders'; // Modules -import view from "./modules/view"; +import view from './modules/view'; // Handlers -import logger from "../../handlers/logger"; +import logger from '../../handlers/logger'; // Function export default { data: new SlashCommandBuilder() - .setName("counters") - .setDescription("Manage counters.") + .setName('counters') + .setDescription('Manage counters.') .addSubcommand((subcommand) => subcommand - .setName("view") - .setDescription("View a counter.") + .setName('view') + .setDescription('View a counter.') .addChannelOption((option) => option - .setName("channel") - .setDescription("The counter channel you want to view") + .setName('channel') + .setDescription('The counter channel you want to view') .setRequired(true) ) ), @@ -28,9 +28,9 @@ export default { const { options, guild, user, commandName } = interaction; // Module - View - if (options?.getSubcommand() === "view") { + if (options?.getSubcommand() === 'view') { // Execute Module - View - return await view(interaction); + return view(interaction); } // Send debug message diff --git a/src/commands/counters/modules/view.ts b/src/commands/counters/modules/view.ts index 68e486e..3b06480 100644 --- a/src/commands/counters/modules/view.ts +++ b/src/commands/counters/modules/view.ts @@ -1,11 +1,11 @@ // Dependencies -import { CommandInteraction, ColorResolvable } from "discord.js"; +import { CommandInteraction, ColorResolvable } from 'discord.js'; // Configurations -import config from "../../../../config.json"; +import config from '../../../../config.json'; // Models -import counterSchema from "../../../helpers/database/models/counterSchema"; +import counterSchema from '../../../helpers/database/models/counterSchema'; // Function export default async (interaction: CommandInteraction) => { @@ -13,7 +13,7 @@ export default async (interaction: CommandInteraction) => { const { options, guild } = interaction; // Get options - const optionChannel = options?.getChannel("channel"); + const optionChannel = options?.getChannel('channel'); const counter = await counterSchema?.findOne({ guildId: guild?.id, @@ -23,9 +23,9 @@ export default async (interaction: CommandInteraction) => { if (!counter) { // Create embed object const embed = { - title: ":1234: Counters [View]" as string, + title: ':1234: Counters [View]' as string, description: `${optionChannel} is not a counting channel.` as string, - timestamp: new Date() as Date, + timestamp: new Date(), color: config?.colors?.error as ColorResolvable, footer: { iconURL: config?.footer?.icon as string, @@ -34,15 +34,15 @@ export default async (interaction: CommandInteraction) => { }; // Send interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); } // Embed object const embed = { - title: ":1234: Counters [View]" as string, + title: ':1234: Counters [View]' as string, color: config.colors.success as ColorResolvable, description: `${optionChannel} is currently at number ${counter?.counter}.`, - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -50,5 +50,5 @@ export default async (interaction: CommandInteraction) => { }; // Send interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); }; diff --git a/src/commands/credits/index.ts b/src/commands/credits/index.ts index b522c61..92e2ea4 100644 --- a/src/commands/credits/index.ts +++ b/src/commands/credits/index.ts @@ -1,83 +1,83 @@ // Dependencies -import { SlashCommandBuilder } from "@discordjs/builders"; -import { CommandInteraction } from "discord.js"; +import { SlashCommandBuilder } from '@discordjs/builders'; +import { CommandInteraction } from 'discord.js'; // Handlers -import logger from "../../handlers/logger"; +import logger from '../../handlers/logger'; // Modules -import balance from "./modules/balance"; -import gift from "./modules/gift"; -import top from "./modules/top"; -import work from "./modules/work"; +import balance from './modules/balance'; +import gift from './modules/gift'; +import top from './modules/top'; +import work from './modules/work'; // Function export default { data: new SlashCommandBuilder() - .setName("credits") - .setDescription("Manage your credits.") + .setName('credits') + .setDescription('Manage your credits.') .addSubcommand((subcommand) => subcommand - .setName("balance") + .setName('balance') .setDescription("Check a user's balance.") .addUserOption((option) => option - .setName("user") - .setDescription("The user whose balance you want to check.") + .setName('user') + .setDescription('The user whose balance you want to check.') .setRequired(false) ) ) .addSubcommand((subcommand) => subcommand - .setName("gift") - .setDescription("Gift someone credits from your credits.") + .setName('gift') + .setDescription('Gift someone credits from your credits.') .addUserOption((option) => option - .setName("user") - .setDescription("The user you want to pay.") + .setName('user') + .setDescription('The user you want to pay.') .setRequired(true) ) .addIntegerOption((option) => option - .setName("amount") - .setDescription("The amount you will pay.") + .setName('amount') + .setDescription('The amount you will pay.') .setRequired(true) ) .addStringOption((option) => - option.setName("reason").setDescription("Your reason.") + option.setName('reason').setDescription('Your reason.') ) ) .addSubcommand((subcommand) => - subcommand.setName("top").setDescription("Check the top balance.") + subcommand.setName('top').setDescription('Check the top balance.') ) .addSubcommand((subcommand) => - subcommand.setName("work").setDescription("Work for credits.") + subcommand.setName('work').setDescription('Work for credits.') ), async execute(interaction: CommandInteraction) { const { options, user, guild, commandName } = interaction; // Module - Balance - if (options?.getSubcommand() === "balance") { + if (options?.getSubcommand() === 'balance') { // Execute Module - Balance - return await balance(interaction); + return balance(interaction); } // Module - Gift - else if (options?.getSubcommand() === "gift") { + else if (options?.getSubcommand() === 'gift') { // Execute Module - Gift - return await gift(interaction); + return gift(interaction); } // Module - Top - else if (options?.getSubcommand() === "top") { + else if (options?.getSubcommand() === 'top') { // Execute Module - Top - return await top(interaction); + return top(interaction); } // Module - Work - else if (options?.getSubcommand() === "work") { + else if (options?.getSubcommand() === 'work') { // Execute Module - Work - return await work(interaction); + return work(interaction); } // Send debug message diff --git a/src/commands/credits/modules/balance.ts b/src/commands/credits/modules/balance.ts index 8a8b6e9..c3c4c3d 100644 --- a/src/commands/credits/modules/balance.ts +++ b/src/commands/credits/modules/balance.ts @@ -1,14 +1,14 @@ // Dependencies -import { CommandInteraction, ColorResolvable } from "discord.js"; +import { CommandInteraction, ColorResolvable } from 'discord.js'; // Configurations -import config from "../../../../config.json"; +import config from '../../../../config.json'; // 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) => { @@ -16,7 +16,7 @@ export default async (interaction: CommandInteraction) => { const { options, user, guild } = interaction; // User option - const optionUser = options?.getUser("user"); + const optionUser = options?.getUser('user'); if (guild === null) return; @@ -27,12 +27,12 @@ export default async (interaction: CommandInteraction) => { if (userDB === null) { // Embed object const embed = { - title: ":dollar: Credits [Balance]" as string, + title: ':dollar: Credits [Balance]' as string, description: `We can not find ${ - optionUser || "you" + optionUser || 'you' } in our database.` as string, color: config?.colors?.error as ColorResolvable, - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -47,12 +47,12 @@ export default async (interaction: CommandInteraction) => { if (userDB.credits === null) { // Embed object const embed = { - title: ":dollar: Credits [Balance]" as string, + title: ':dollar: Credits [Balance]' as string, description: `We can not find credits for ${ - optionUser || "you" + optionUser || 'you' } in our database.` as string, color: config?.colors?.error as ColorResolvable, - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -64,12 +64,12 @@ export default async (interaction: CommandInteraction) => { } else { // Embed object const embed = { - title: ":dollar: Credits [Balance]" as string, + title: ':dollar: Credits [Balance]' as string, description: `${ - optionUser ? `${optionUser} has` : "You have" + optionUser ? `${optionUser} has` : 'You have' } ${creditNoun(userDB.credits)}.` as string, color: config?.colors?.success as ColorResolvable, - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, diff --git a/src/commands/credits/modules/gift.ts b/src/commands/credits/modules/gift.ts index 9d6a93a..9baa19b 100644 --- a/src/commands/credits/modules/gift.ts +++ b/src/commands/credits/modules/gift.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 saveUser from "../../../helpers/saveUser"; -import creditNoun from "../../../helpers/creditNoun"; +import saveUser from '../../../helpers/saveUser'; +import creditNoun from '../../../helpers/creditNoun'; // Models -import fetchUser from "../../../helpers/fetchUser"; +import fetchUser from '../../../helpers/fetchUser'; // Function export default async (interaction: CommandInteraction) => { @@ -20,13 +20,13 @@ export default async (interaction: CommandInteraction) => { const { options, user, guild, client } = 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'); // Reason option - const optionReason = options?.getString("reason"); + const optionReason = options?.getString('reason'); if (guild === null) return; if (optionUser === null) return; @@ -44,10 +44,10 @@ export default async (interaction: CommandInteraction) => { if (optionUser?.id === user?.id) { // Create embed object const embed = { - title: ":dollar: Credits [Gift]" as string, + title: ':dollar: Credits [Gift]' as string, description: "You can't pay yourself." as string, color: config?.colors?.error as ColorResolvable, - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -55,17 +55,17 @@ export default async (interaction: CommandInteraction) => { }; // Return interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); } // If amount is null if (optionAmount === null) { // Embed object const embed = { - title: ":dollar: Credits [Gift]" as string, - description: "We could not read your requested amount." as string, + title: ':dollar: Credits [Gift]' as string, + description: 'We could not read your requested amount.' as string, color: config?.colors?.error as ColorResolvable, - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -73,17 +73,17 @@ export default async (interaction: CommandInteraction) => { }; // Send interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); } // If amount is zero or below if (optionAmount <= 0) { // Embed object const embed = { - title: ":dollar: Credits [Gift]" as string, + title: ':dollar: Credits [Gift]' as string, description: "You can't pay zero or below." as string, color: config?.colors?.error as ColorResolvable, - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -91,18 +91,18 @@ export default async (interaction: CommandInteraction) => { }; // Return interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); } // If user has below gifting amount if (fromUserDB?.credits < optionAmount) { // Embed object const embed = { - title: ":dollar: Credits [Gift]" as string, + title: ':dollar: Credits [Gift]' as string, description: `You have insufficient credits. Your credits is ${fromUserDB?.credits}` as string, color: config?.colors?.error as ColorResolvable, - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -110,18 +110,18 @@ export default async (interaction: CommandInteraction) => { }; // Return interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); } // If toUserDB has no credits if (!toUserDB) { // Embed object const embed = { - title: ":dollar: Credits [Gift]" as string, + title: ':dollar: Credits [Gift]' as string, description: `That user has no credits, I can not gift credits to ${optionUser}` as string, color: config?.colors?.error as ColorResolvable, - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -129,7 +129,7 @@ export default async (interaction: CommandInteraction) => { }; // Send interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); } // Withdraw amount from fromUserDB @@ -142,12 +142,12 @@ export default async (interaction: CommandInteraction) => { await saveUser(fromUserDB, toUserDB)?.then(async () => { // Interaction embed object const interactionEmbed = { - title: ":dollar: Credits [Gift]", + title: ':dollar: Credits [Gift]', description: `You sent ${creditNoun(optionAmount)} to ${optionUser}${ - optionReason ? ` with reason: ${optionReason}` : "" + optionReason ? ` with reason: ${optionReason}` : '' }. Your new credits is ${creditNoun(fromUserDB?.credits)}.`, color: config?.colors?.success as ColorResolvable, - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -156,12 +156,12 @@ export default async (interaction: CommandInteraction) => { // DM embed object const dmEmbed = { - title: ":dollar: Credits [Gift]" as string, + title: ':dollar: Credits [Gift]' as string, description: `You received ${creditNoun(optionAmount)} from ${user}${ - optionReason ? ` with reason: ${optionReason}` : "" + optionReason ? ` with reason: ${optionReason}` : '' }. Your new credits is ${creditNoun(toUserDB?.credits)}.` as string, color: config?.colors?.success as ColorResolvable, - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -180,7 +180,7 @@ export default async (interaction: CommandInteraction) => { ); // Send interaction reply - return await interaction.editReply({ + return interaction.editReply({ embeds: [interactionEmbed], }); }); diff --git a/src/commands/credits/modules/top.ts b/src/commands/credits/modules/top.ts index 7577f1f..f5da21c 100644 --- a/src/commands/credits/modules/top.ts +++ b/src/commands/credits/modules/top.ts @@ -1,14 +1,14 @@ // Dependencies -import { CommandInteraction, ColorResolvable } from "discord.js"; +import { CommandInteraction, ColorResolvable } from 'discord.js'; // Configurations -import config from "../../../../config.json"; +import config from '../../../../config.json'; // Models -import userSchema from "../../../helpers/database/models/userSchema"; +import userSchema from '../../../helpers/database/models/userSchema'; // helpers -import creditNoun from "../../../helpers/creditNoun"; +import creditNoun from '../../../helpers/creditNoun'; // Function export default async (interaction: CommandInteraction) => { @@ -30,12 +30,12 @@ export default async (interaction: CommandInteraction) => { // Create embed object const embed = { - title: ":dollar: Credits [Top]" as string, + title: ':dollar: Credits [Top]' as string, description: `Below are the top ten.\n${topTen ?.map((x, index) => entry(x, index)) - ?.join("\n")}` as string, + ?.join('\n')}` as string, color: config?.colors?.success as ColorResolvable, - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -43,5 +43,5 @@ export default async (interaction: CommandInteraction) => { }; // Return interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); }; diff --git a/src/commands/credits/modules/work.ts b/src/commands/credits/modules/work.ts index 6b5030e..ff59b6b 100644 --- a/src/commands/credits/modules/work.ts +++ b/src/commands/credits/modules/work.ts @@ -1,20 +1,20 @@ // Dependencies -import { CommandInteraction, ColorResolvable } from "discord.js"; -import Chance from "chance"; +import { CommandInteraction, ColorResolvable } from 'discord.js'; +import Chance from 'chance'; // Configurations -import config from "../../../../config.json"; +import config from '../../../../config.json'; // Handlers -import logger from "../../../handlers/logger"; +import logger from '../../../handlers/logger'; // Models -import timeouts from "../../../helpers/database/models/timeoutSchema"; +import timeouts from '../../../helpers/database/models/timeoutSchema'; // Helpers -import creditNoun from "../../../helpers/creditNoun"; -import fetchUser from "../../../helpers/fetchUser"; -import fetchGuild from "../../../helpers/fetchGuild"; +import creditNoun from '../../../helpers/creditNoun'; +import fetchUser from '../../../helpers/fetchUser'; +import fetchGuild from '../../../helpers/fetchGuild'; // Function export default async (interaction: CommandInteraction) => { @@ -28,7 +28,7 @@ export default async (interaction: CommandInteraction) => { const isTimeout = await timeouts?.findOne({ guildId: guild?.id, userId: user?.id, - timeoutId: "2022-03-15-19-16", + timeoutId: '2022-03-15-19-16', }); if (guild === null) return; @@ -54,10 +54,10 @@ export default async (interaction: CommandInteraction) => { // Create embed object const embed = { - title: ":dollar: Credits [Work]" as string, + title: ':dollar: Credits [Work]' as string, description: `You have earned ${creditNoun(creditsEarned)}` as string, color: config?.colors?.success as ColorResolvable, - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -65,14 +65,14 @@ export default async (interaction: CommandInteraction) => { }; // Send interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); }); // Create a timeout for the user await timeouts?.create({ guildId: guild?.id, userId: user?.id, - timeoutId: "2022-03-15-19-16", + timeoutId: '2022-03-15-19-16', }); setTimeout(async () => { @@ -87,17 +87,17 @@ export default async (interaction: CommandInteraction) => { await timeouts?.deleteOne({ guildId: guild?.id, userId: user?.id, - timeoutId: "2022-03-15-19-16", + timeoutId: '2022-03-15-19-16', }); }, guildDB?.credits?.workTimeout); } else { // Create embed object const embed = { - title: ":dollar: Credits [Work]" as string, + title: ':dollar: Credits [Work]' as string, description: `You have worked within the last ${ guildDB?.credits?.workTimeout / 1000 } seconds, you can not work now!` as string, - timestamp: new Date() as Date, + timestamp: new Date(), color: config?.colors?.error as ColorResolvable, footer: { iconURL: config?.footer?.icon as string, @@ -111,6 +111,6 @@ export default async (interaction: CommandInteraction) => { ); // Return interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); } }; diff --git a/src/commands/profile/index.ts b/src/commands/profile/index.ts index cf867e0..96d3e77 100644 --- a/src/commands/profile/index.ts +++ b/src/commands/profile/index.ts @@ -1,26 +1,26 @@ // Dependencies -import { SlashCommandBuilder } from "@discordjs/builders"; -import { CommandInteraction } from "discord.js"; +import { SlashCommandBuilder } from '@discordjs/builders'; +import { CommandInteraction } from 'discord.js'; // Modules -import view from "./modules/view"; +import view from './modules/view'; // Handlers -import logger from "../../handlers/logger"; +import logger from '../../handlers/logger'; // Function export default { data: new SlashCommandBuilder() - .setName("profile") - .setDescription("Check a profile.") + .setName('profile') + .setDescription('Check a profile.') .addSubcommand((subcommand) => subcommand - .setName("view") - .setDescription("View a profile.") + .setName('view') + .setDescription('View a profile.') .addUserOption((option) => option - .setName("target") - .setDescription("The profile you wish to view") + .setName('target') + .setDescription('The profile you wish to view') ) ), async execute(interaction: CommandInteraction) { @@ -28,9 +28,9 @@ export default { const { options, guild, user, commandName } = interaction; // Module - View - if (options?.getSubcommand() === "view") { + if (options?.getSubcommand() === 'view') { // Execute Module - View - return await view(interaction); + return view(interaction); } // Send debug message diff --git a/src/commands/profile/modules/view.ts b/src/commands/profile/modules/view.ts index 2a33560..bb190ef 100644 --- a/src/commands/profile/modules/view.ts +++ b/src/commands/profile/modules/view.ts @@ -1,11 +1,11 @@ // Dependencies -import { CommandInteraction, ColorResolvable } from "discord.js"; +import { CommandInteraction, ColorResolvable } from 'discord.js'; // Configurations -import config from "../../../../config.json"; +import config from '../../../../config.json'; // Models -import fetchUser from "../../../helpers/fetchUser"; +import fetchUser from '../../../helpers/fetchUser'; // Function export default async (interaction: CommandInteraction) => { @@ -13,7 +13,7 @@ export default async (interaction: CommandInteraction) => { const { client, options, user, guild } = interaction; // Target information - const target = options?.getUser("target"); + const target = options?.getUser('target'); // Discord User Information const discordUser = await client?.users?.fetch( @@ -35,31 +35,31 @@ export default async (interaction: CommandInteraction) => { fields: [ { name: `:dollar: Credits` as string, - value: `${userObj?.credits || "Not found"}` as string, + value: `${userObj?.credits || 'Not found'}` as string, inline: true, }, { name: `:squeeze_bottle: Level` as string, - value: `${userObj?.level || "Not found"}` as string, + value: `${userObj?.level || 'Not found'}` as string, inline: true, }, { name: `:squeeze_bottle: Points` as string, - value: `${userObj?.points || "Not found"}` as string, + value: `${userObj?.points || 'Not found'}` as string, inline: true, }, { name: `:loudspeaker: Reputation` as string, - value: `${userObj?.reputation || "Not found"}` as string, + value: `${userObj?.reputation || 'Not found'}` as string, inline: true, }, { name: `:rainbow_flag: Language` as string, - value: `${userObj?.language || "Not found"}` as string, + value: `${userObj?.language || 'Not found'}` as string, inline: true, }, ], - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -67,5 +67,5 @@ export default async (interaction: CommandInteraction) => { }; // Return interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); }; diff --git a/src/commands/reputation/modules/give.ts b/src/commands/reputation/modules/give.ts index 5d4fb2b..0fc31bf 100644 --- a/src/commands/reputation/modules/give.ts +++ b/src/commands/reputation/modules/give.ts @@ -1,15 +1,15 @@ // 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'; // Models -import timeoutSchema from "../../../helpers/database/models/timeoutSchema"; -import fetchUser from "../../../helpers/fetchUser"; +import timeoutSchema from '../../../helpers/database/models/timeoutSchema'; +import fetchUser from '../../../helpers/fetchUser'; // Function export default async (interaction: CommandInteraction) => { @@ -17,10 +17,10 @@ export default async (interaction: CommandInteraction) => { const { options, user, guild } = interaction; // Target option - const optionTarget = options?.getUser("target"); + const optionTarget = options?.getUser('target'); // Type information - const optionType = options?.getString("type"); + const optionType = options?.getString('type'); if (guild === null) return; @@ -33,7 +33,7 @@ export default async (interaction: CommandInteraction) => { const isTimeout = await timeoutSchema?.findOne({ guildId: guild?.id, userId: user?.id, - timeoutId: "2022-04-10-16-42", + timeoutId: '2022-04-10-16-42', }); // If user is not on timeout @@ -42,9 +42,9 @@ export default async (interaction: CommandInteraction) => { if (optionTarget?.id === user?.id) { // Embed object const embed = { - title: ":loudspeaker: Reputation [Give]" as string, - description: "You can not repute yourself." as string, - timestamp: new Date() as Date, + title: ':loudspeaker: Reputation [Give]' as string, + description: 'You can not repute yourself.' as string, + timestamp: new Date(), color: config?.colors?.error as ColorResolvable, footer: { iconURL: config?.footer?.icon as string, @@ -53,16 +53,16 @@ export default async (interaction: CommandInteraction) => { }; // Return interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); } // If type is positive - if (optionType === "positive") { + if (optionType === 'positive') { userObj.reputation += 1; } // If type is negative - else if (optionType === "negative") { + else if (optionType === 'negative') { userObj.reputation -= 1; } @@ -70,10 +70,10 @@ export default async (interaction: CommandInteraction) => { await userObj?.save()?.then(async () => { // Embed object const embed = { - title: ":loudspeaker: Reputation [Give]" as string, + title: ':loudspeaker: Reputation [Give]' as string, description: `You have given ${optionTarget} a ${optionType} reputation!` as string, - timestamp: new Date() as Date, + timestamp: new Date(), color: config?.colors?.success as ColorResolvable, footer: { iconURL: config?.footer?.icon as string, @@ -90,10 +90,10 @@ export default async (interaction: CommandInteraction) => { await timeoutSchema?.create({ guildId: guild?.id, userId: user?.id, - timeoutId: "2022-04-10-16-42", + timeoutId: '2022-04-10-16-42', }); // Return interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); }); setTimeout(async () => { @@ -108,17 +108,17 @@ export default async (interaction: CommandInteraction) => { await timeoutSchema?.deleteOne({ guildId: guild?.id, userId: user?.id, - timeoutId: "2022-04-10-16-42", + timeoutId: '2022-04-10-16-42', }); }, config?.reputation?.timeout); } else { // Create embed object const embed = { - title: ":loudspeaker: Reputation [Give]" as string, + title: ':loudspeaker: Reputation [Give]' as string, description: `You have given reputation within the last ${ config?.reputation?.timeout / 1000 } seconds, you can not repute now!` as string, - timestamp: new Date() as Date, + timestamp: new Date(), color: config.colors.error as ColorResolvable, footer: { iconURL: config?.footer?.icon as string, @@ -134,6 +134,6 @@ export default async (interaction: CommandInteraction) => { ); // Return interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); } }; diff --git a/src/commands/settings/guild/addons/credits.ts b/src/commands/settings/guild/addons/credits.ts index 411ed20..32cf20e 100644 --- a/src/commands/settings/guild/addons/credits.ts +++ b/src/commands/settings/guild/addons/credits.ts @@ -1,14 +1,14 @@ // Dependencies -import { ColorResolvable, CommandInteraction } from "discord.js"; +import { ColorResolvable, CommandInteraction } 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'; // Models -import guildSchema from "../../../../helpers/database/models/guildSchema"; +import guildSchema from '../../../../helpers/database/models/guildSchema'; // Function export default async (interaction: CommandInteraction) => { @@ -16,12 +16,12 @@ export default async (interaction: CommandInteraction) => { const { guild, user, options } = interaction; // Get options - const status = options?.getBoolean("status"); - const rate = options?.getNumber("rate"); - const timeout = options?.getNumber("timeout"); - const minimumLength = options?.getNumber("minimum-length"); - const workRate = options?.getNumber("work-rate"); - const workTimeout = options?.getNumber("work-timeout"); + const status = options?.getBoolean('status'); + const rate = options?.getNumber('rate'); + const timeout = options?.getNumber('timeout'); + const minimumLength = options?.getNumber('minimum-length'); + const workRate = options?.getNumber('work-rate'); + const workTimeout = options?.getNumber('work-timeout'); // Get guild object const guildDB = await guildSchema?.findOne({ @@ -44,42 +44,42 @@ export default async (interaction: CommandInteraction) => { await guildDB?.save()?.then(async () => { // Embed object const embed = { - title: ":tools: Settings - Guild [Credits]" as string, - description: "Following settings is set!" as string, + title: ':tools: Settings - Guild [Credits]' as string, + description: 'Following settings is set!' as string, color: config?.colors?.success as ColorResolvable, fields: [ { - name: "🤖 Status" as string, + name: '🤖 Status' as string, value: `${guildDB?.credits?.status}` as string, inline: true, }, { - name: "📈 Rate" as string, + name: '📈 Rate' as string, value: `${guildDB?.credits?.rate}` as string, inline: true, }, { - name: "📈 Work Rate" as string, + name: '📈 Work Rate' as string, value: `${guildDB?.credits?.workRate}` as string, inline: true, }, { - name: "🔨 Minimum Length" as string, + name: '🔨 Minimum Length' as string, value: `${guildDB?.credits?.minimumLength}` as string, inline: true, }, { - name: "⏰ Timeout" as string, + name: '⏰ Timeout' as string, value: `${guildDB?.credits?.timeout}` as string, inline: true, }, { - name: "⏰ Work Timeout" as string, + name: '⏰ Work Timeout' as string, value: `${guildDB?.credits?.workTimeout}` as string, inline: true, }, ], - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -92,6 +92,6 @@ export default async (interaction: CommandInteraction) => { ); // Return interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); }); }; diff --git a/src/commands/settings/guild/addons/points.ts b/src/commands/settings/guild/addons/points.ts index 9113d4b..9a8a718 100644 --- a/src/commands/settings/guild/addons/points.ts +++ b/src/commands/settings/guild/addons/points.ts @@ -1,14 +1,14 @@ // Dependencies -import { ColorResolvable, CommandInteraction } from "discord.js"; +import { ColorResolvable, CommandInteraction } 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'; // Models -import guildSchema from "../../../../helpers/database/models/guildSchema"; +import guildSchema from '../../../../helpers/database/models/guildSchema'; // Function export default async (interaction: CommandInteraction) => { @@ -16,10 +16,10 @@ export default async (interaction: CommandInteraction) => { const { options, guild, user } = interaction; // Get options - const status = options?.getBoolean("status"); - const rate = options?.getNumber("rate"); - const timeout = options?.getNumber("timeout"); - const minimumLength = options?.getNumber("minimum-length"); + const status = options?.getBoolean('status'); + const rate = options?.getNumber('rate'); + const timeout = options?.getNumber('timeout'); + const minimumLength = options?.getNumber('minimum-length'); // Get guild object const guildDB = await guildSchema?.findOne({ @@ -38,32 +38,32 @@ export default async (interaction: CommandInteraction) => { await guildDB?.save()?.then(async () => { // Create embed object const embed = { - title: ":hammer: Settings - Guild [Points]" as string, - description: "Following settings is set!" as string, + title: ':hammer: Settings - Guild [Points]' as string, + description: 'Following settings is set!' as string, color: config.colors.success as ColorResolvable, fields: [ { - name: "🤖 Status" as string, + name: '🤖 Status' as string, value: `${guildDB?.points?.status}` as string, inline: true, }, { - name: "📈 Rate" as string, + name: '📈 Rate' as string, value: `${guildDB?.points?.rate}` as string, inline: true, }, { - name: "🔨 Minimum Length" as string, + name: '🔨 Minimum Length' as string, value: `${guildDB?.points?.minimumLength}` as string, inline: true, }, { - name: "⏰ Timeout" as string, + name: '⏰ Timeout' as string, value: `${guildDB?.points?.timeout}` as string, inline: true, }, ], - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -76,6 +76,6 @@ export default async (interaction: CommandInteraction) => { ); // Return interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); }); }; diff --git a/src/commands/settings/guild/addons/pterodactyl.ts b/src/commands/settings/guild/addons/pterodactyl.ts index 7bbae1a..32f7f0c 100644 --- a/src/commands/settings/guild/addons/pterodactyl.ts +++ b/src/commands/settings/guild/addons/pterodactyl.ts @@ -1,14 +1,14 @@ // Dependencies -import { ColorResolvable, CommandInteraction } from "discord.js"; +import { ColorResolvable, CommandInteraction } 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'; // Models -import apiSchema from "../../../../helpers/database/models/apiSchema"; +import apiSchema from '../../../../helpers/database/models/apiSchema'; // Function export default async (interaction: CommandInteraction) => { @@ -16,8 +16,8 @@ export default async (interaction: CommandInteraction) => { const { options, guild, user } = interaction; // Get options - const url = options?.getString("url"); - const token = options?.getString("token"); + const url = options?.getString('url'); + const token = options?.getString('token'); // Update API credentials await apiSchema @@ -29,10 +29,10 @@ export default async (interaction: CommandInteraction) => { .then(async () => { // Embed object const embed = { - title: ":hammer: Settings - Guild [Pterodactyl]" as string, + title: ':hammer: Settings - Guild [Pterodactyl]' as string, color: config?.colors?.success as ColorResolvable, - description: "Pterodactyl settings is saved!" as string, - timestamp: new Date() as Date, + description: 'Pterodactyl settings is saved!' as string, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -45,6 +45,6 @@ export default async (interaction: CommandInteraction) => { ); // Return interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); }); }; diff --git a/src/commands/settings/guild/index.ts b/src/commands/settings/guild/index.ts index f03cde3..34e28b7 100644 --- a/src/commands/settings/guild/index.ts +++ b/src/commands/settings/guild/index.ts @@ -1,16 +1,16 @@ // Dependencies -import { Permissions, ColorResolvable, CommandInteraction } from "discord.js"; +import { Permissions, ColorResolvable, CommandInteraction } 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'; // Modules -import pterodactyl from "./addons/pterodactyl"; -import credits from "./addons/credits"; -import points from "./addons/points"; +import pterodactyl from './addons/pterodactyl'; +import credits from './addons/credits'; +import points from './addons/points'; // Function export default async (interaction: CommandInteraction) => { @@ -21,10 +21,10 @@ export default async (interaction: CommandInteraction) => { if (!memberPermissions?.has(Permissions?.FLAGS?.MANAGE_GUILD)) { // Create embed object const embed = { - title: ":tools: Settings - Guild" as string, + title: ':tools: Settings - Guild' as string, color: config?.colors?.error as ColorResolvable, - description: "You do not have permission to manage this!" as string, - timestamp: new Date() as Date, + description: 'You do not have permission to manage this!' as string, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -32,25 +32,25 @@ export default async (interaction: CommandInteraction) => { }; // Return interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); } // Module - Pterodactyl - if (options?.getSubcommand() === "pterodactyl") { + if (options?.getSubcommand() === 'pterodactyl') { // Execute Module - Pterodactyl - return await pterodactyl(interaction); + return pterodactyl(interaction); } // Module - Credits - else if (options?.getSubcommand() === "credits") { + else if (options?.getSubcommand() === 'credits') { // Execute Module - Credits - return await credits(interaction); + return credits(interaction); } // Module - Points - else if (options?.getSubcommand() === "points") { + else if (options?.getSubcommand() === 'points') { // Execute Module - Points - return await points(interaction); + return points(interaction); } // Send debug message diff --git a/src/commands/settings/user/modules/appearance.ts b/src/commands/settings/user/modules/appearance.ts index 053c4dc..e3437f8 100644 --- a/src/commands/settings/user/modules/appearance.ts +++ b/src/commands/settings/user/modules/appearance.ts @@ -1,14 +1,14 @@ // 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'; // Models -import fetchUser from "../../../../helpers/fetchUser"; +import fetchUser from '../../../../helpers/fetchUser'; // Function export default async (interaction: CommandInteraction) => { @@ -16,7 +16,7 @@ export default async (interaction: CommandInteraction) => { const { options, user, guild } = interaction; // Get options - const language = options?.getString("language"); + const language = options?.getString('language'); if (guild === null) return; @@ -32,17 +32,17 @@ export default async (interaction: CommandInteraction) => { await userDB?.save()?.then(async () => { // Embed object const embed = { - title: ":hammer: Settings - User [Appearance]" as string, - description: "Following settings is set!" as string, + title: ':hammer: Settings - User [Appearance]' as string, + description: 'Following settings is set!' as string, color: config?.colors?.success as ColorResolvable, fields: [ { - name: "🏳️‍🌈 Language" as string, + name: '🏳️‍🌈 Language' as string, value: `${userDB?.language}` as string, inline: true, }, ], - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -55,6 +55,6 @@ export default async (interaction: CommandInteraction) => { ); // Return interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); }); }; diff --git a/src/commands/shop/index.ts b/src/commands/shop/index.ts index 47bad3a..bab78f8 100644 --- a/src/commands/shop/index.ts +++ b/src/commands/shop/index.ts @@ -1,53 +1,53 @@ // Dependencies -import { SlashCommandBuilder } from "@discordjs/builders"; -import { CommandInteraction } from "discord.js"; +import { SlashCommandBuilder } from '@discordjs/builders'; +import { CommandInteraction } from 'discord.js'; // Modules -import pterodactyl from "./modules/pterodactyl"; +import pterodactyl from './modules/pterodactyl'; // Groups -import roles from "./roles"; +import roles from './roles'; // Handlers -import logger from "../../handlers/logger"; +import logger from '../../handlers/logger'; // Function export default { data: new SlashCommandBuilder() - .setName("shop") - .setDescription("Open our shop.") + .setName('shop') + .setDescription('Open our shop.') .addSubcommand((subcommand) => subcommand - .setName("pterodactyl") - .setDescription("Buy pterodactyl power.") + .setName('pterodactyl') + .setDescription('Buy pterodactyl power.') .addIntegerOption((option) => option - .setName("amount") - .setDescription("How much credits you want to withdraw.") + .setName('amount') + .setDescription('How much credits you want to withdraw.') ) ) .addSubcommandGroup((group) => group - .setName("roles") - .setDescription("Manage custom roles.") + .setName('roles') + .setDescription('Manage custom roles.') .addSubcommand((command) => command - .setName("buy") - .setDescription("Buy a custom role") + .setName('buy') + .setDescription('Buy a custom role') .addStringOption((option) => option - .setName("name") - .setDescription("Name of the role you wish to purchase.") + .setName('name') + .setDescription('Name of the role you wish to purchase.') ) ) .addSubcommand((command) => command - .setName("cancel") - .setDescription("Cancel a custom role") + .setName('cancel') + .setDescription('Cancel a custom role') .addRoleOption((option) => option - .setName("role") - .setDescription("Name of the role you wish to cancel.") + .setName('role') + .setDescription('Name of the role you wish to cancel.') ) ) ), @@ -56,15 +56,15 @@ export default { const { options, commandName, user, guild } = interaction; // Module - Pterodactyl - if (options?.getSubcommand() === "pterodactyl") { + if (options?.getSubcommand() === 'pterodactyl') { // Execute Module - Pterodactyl - return await pterodactyl(interaction); + return pterodactyl(interaction); } // Group - Roles - else if (options?.getSubcommandGroup() === "roles") { + else if (options?.getSubcommandGroup() === 'roles') { // Execute Group - Roles - return await roles(interaction); + return roles(interaction); } // Send debug message diff --git a/src/commands/shop/modules/pterodactyl.ts b/src/commands/shop/modules/pterodactyl.ts index 197a240..aac47f0 100644 --- a/src/commands/shop/modules/pterodactyl.ts +++ b/src/commands/shop/modules/pterodactyl.ts @@ -1,36 +1,36 @@ // Dependencies -import { CommandInteraction, ColorResolvable } from "discord.js"; -import { v4 as uuidv4 } from "uuid"; -import axios from "axios"; +import { CommandInteraction, ColorResolvable } from 'discord.js'; +import { v4 as uuidv4 } from 'uuid'; +import axios from 'axios'; // 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 apiSchema from "../../../helpers/database/models/apiSchema"; -import fetchUser from "../../../helpers/fetchUser"; +import apiSchema from '../../../helpers/database/models/apiSchema'; +import fetchUser from '../../../helpers/fetchUser'; // Function export default async (interaction: CommandInteraction) => { const { options, guild, user, client } = interaction; // Get options - const optionAmount = options?.getInteger("amount"); + const optionAmount = options?.getInteger('amount'); // If amount is null if (optionAmount === null) { // Embed object const embed = { - title: ":dollar: Credits [Gift]" as string, - description: "We could not read your requested amount." as string, + title: ':dollar: Credits [Gift]' as string, + description: 'We could not read your requested amount.' as string, color: config?.colors?.error as ColorResolvable, - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -38,7 +38,7 @@ export default async (interaction: CommandInteraction) => { }; // Send interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); } if (guild === null) return; @@ -54,17 +54,17 @@ export default async (interaction: CommandInteraction) => { // Stop if amount or user credits is below 100 if ((optionAmount || userDB?.credits) < 100) { const embed = { - title: ":shopping_cart: Shop [Pterodactyl]" as string, + title: ':shopping_cart: Shop [Pterodactyl]' as string, description: `You **can't** withdraw for __Pterodactyl__ below **100**.` as string, color: config?.colors?.error as ColorResolvable, fields: [ { - name: "Your balance" as string, + name: 'Your balance' as string, value: `${creditNoun(userDB?.credits)}` as string, }, ], - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -76,17 +76,17 @@ export default async (interaction: CommandInteraction) => { // Stop if amount or user credits is above 1.000.000 if ((optionAmount || userDB?.credits) > 1000000) { const embed = { - title: ":shopping_cart: Shop [Pterodactyl]" as string, + title: ':shopping_cart: Shop [Pterodactyl]' as string, description: `You **can't** withdraw for __Pterodactyl__ above **1.000.000**.` as string, color: config?.colors?.error as ColorResolvable, fields: [ { - name: "Your balance" as string, + name: 'Your balance' as string, value: `${creditNoun(userDB?.credits)}` as string, }, ], - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -98,16 +98,16 @@ export default async (interaction: CommandInteraction) => { // Stop if user credits is below amount if (userDB?.credits < optionAmount) { const embed = { - title: ":shopping_cart: Shop [Pterodactyl]" as string, + title: ':shopping_cart: Shop [Pterodactyl]' as string, description: `You have **insufficient** credits.` as string, color: config.colors.error as ColorResolvable, fields: [ { - name: "Your balance" as string, + name: 'Your balance' as string, value: `${creditNoun(userDB?.credits)}` as string, }, ], - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -131,13 +131,13 @@ export default async (interaction: CommandInteraction) => { }); // Get shop URL - const shopUrl = apiCredentials?.url?.replace("/api", "/store"); + const shopUrl = apiCredentials?.url?.replace('/api', '/store'); // Make API request await api // Make a post request to the API - ?.post("vouchers", { + ?.post('vouchers', { uses: 1, code, credits: optionAmount || userDB?.credits, @@ -148,18 +148,18 @@ export default async (interaction: CommandInteraction) => { ?.then(async () => { // Create DM embed object const dmEmbed = { - title: ":shopping_cart: Shop [Pterodactyl]" as string, + title: ':shopping_cart: Shop [Pterodactyl]' as string, description: `Redeem this voucher [here](${shopUrl})!` as string, fields: [ - { name: "Code" as string, value: `${code}` as string, inline: true }, + { name: 'Code' as string, value: `${code}` as string, inline: true }, { - name: "Credits" as string, + name: 'Credits' as string, value: `${optionAmount || userDB?.credits}` as string, inline: true, }, ], color: config?.colors?.success as ColorResolvable, - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -168,10 +168,10 @@ export default async (interaction: CommandInteraction) => { // Create interaction embed object const interactionEmbed = { - title: ":shopping_cart: Shop [Pterodactyl]" as string, - description: "I have sent you the code in DM!" as string, + title: ':shopping_cart: Shop [Pterodactyl]' as string, + description: 'I have sent you the code in DM!' as string, color: config?.colors?.success as ColorResolvable, - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -204,11 +204,11 @@ export default async (interaction: CommandInteraction) => { .catch(async (e: any) => { logger?.error(e); const embed = { - title: ":shopping_cart: Shop [Pterodactyl]" as string, + title: ':shopping_cart: Shop [Pterodactyl]' as string, description: - "Something went wrong, please try again later." as string, + 'Something went wrong, please try again later.' as string, color: config?.colors?.error as ColorResolvable, - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -222,10 +222,10 @@ export default async (interaction: CommandInteraction) => { .catch(async (e) => { logger?.error(e); const embed = { - title: ":shopping_cart: Shop [Pterodactyl]" as string, - description: "Something went wrong, please try again later." as string, + title: ':shopping_cart: Shop [Pterodactyl]' as string, + description: 'Something went wrong, please try again later.' as string, color: config?.colors?.error as ColorResolvable, - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, diff --git a/src/commands/shop/roles/modules/buy.ts b/src/commands/shop/roles/modules/buy.ts index 079402b..fc6cca1 100644 --- a/src/commands/shop/roles/modules/buy.ts +++ b/src/commands/shop/roles/modules/buy.ts @@ -3,33 +3,33 @@ import { CommandInteraction, ColorResolvable, GuildMemberRoleManager, -} from "discord.js"; +} from 'discord.js'; // Configurations -import config from "../../../../../config.json"; +import config from '../../../../../config.json'; // Models -import shopRolesSchema from "../../../../helpers/database/models/shopRolesSchema"; -import guildSchema from "../../../../helpers/database/models/guildSchema"; +import shopRolesSchema from '../../../../helpers/database/models/shopRolesSchema'; +import guildSchema from '../../../../helpers/database/models/guildSchema'; // Helpers -import creditNoun from "../../../../helpers/creditNoun"; -import fetchUser from "../../../../helpers/fetchUser"; +import creditNoun from '../../../../helpers/creditNoun'; +import fetchUser from '../../../../helpers/fetchUser'; // Function export default async (interaction: CommandInteraction) => { const { options, guild, user, member } = interaction; - const optionName = options?.getString("name"); + const optionName = options?.getString('name'); // If amount is null if (optionName === null) { // Embed object const embed = { - title: ":dollar: Shop - Roles [Buy]" as string, - description: "We could not read your requested name." as string, + title: ':dollar: Shop - Roles [Buy]' as string, + description: 'We could not read your requested name.' as string, color: config?.colors?.error as ColorResolvable, - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -37,13 +37,13 @@ export default async (interaction: CommandInteraction) => { }; // Send interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); } await guild?.roles .create({ name: optionName, - color: "RED", + color: 'RED', reason: `${user?.id} bought from shop`, }) .then(async (role) => { @@ -74,17 +74,17 @@ export default async (interaction: CommandInteraction) => { await shopRolesSchema?.find()?.then((role: any) => console.log(role)); const embed = { - title: ":shopping_cart: Shop - Roles [Buy]" as string, + title: ':shopping_cart: Shop - Roles [Buy]' as string, description: `You have bought ${role?.name} for ${guildDB?.shop?.roles?.pricePerHour} per hour.` as string, color: config?.colors?.success as ColorResolvable, fields: [ { - name: "Your balance" as string, + name: 'Your balance' as string, value: `${creditNoun(userDB?.credits)}` as string, }, ], - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, diff --git a/src/commands/shop/roles/modules/cancel.ts b/src/commands/shop/roles/modules/cancel.ts index 3572c30..d6a4a5b 100644 --- a/src/commands/shop/roles/modules/cancel.ts +++ b/src/commands/shop/roles/modules/cancel.ts @@ -3,32 +3,32 @@ import { CommandInteraction, ColorResolvable, GuildMemberRoleManager, -} from "discord.js"; +} from 'discord.js'; // Configurations -import config from "../../../../../config.json"; +import config from '../../../../../config.json'; // Models -import shopRolesSchema from "../../../../helpers/database/models/shopRolesSchema"; +import shopRolesSchema from '../../../../helpers/database/models/shopRolesSchema'; // Helpers -import creditNoun from "../../../../helpers/creditNoun"; -import fetchUser from "../../../../helpers/fetchUser"; +import creditNoun from '../../../../helpers/creditNoun'; +import fetchUser from '../../../../helpers/fetchUser'; // Function export default async (interaction: CommandInteraction) => { const { options, guild, user, member } = interaction; - const optionRole = options.getRole("role"); + const optionRole = options.getRole('role'); // If amount is null if (optionRole === null) { // Embed object const embed = { - title: ":dollar: Shop - Roles [Cancel]" as string, - description: "We could not read your requested role." as string, + title: ':dollar: Shop - Roles [Cancel]' as string, + description: 'We could not read your requested role.' as string, color: config?.colors?.error as ColorResolvable, - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -36,7 +36,7 @@ export default async (interaction: CommandInteraction) => { }; // Send interaction reply - return await interaction?.editReply({ embeds: [embed] }); + return interaction?.editReply({ embeds: [embed] }); } const roleExist = await shopRolesSchema?.find({ @@ -62,16 +62,16 @@ export default async (interaction: CommandInteraction) => { }); const embed = { - title: ":shopping_cart: Shop - Roles [Cancel]" as string, + title: ':shopping_cart: Shop - Roles [Cancel]' as string, description: `You have canceled ${optionRole.name}.` as string, color: config?.colors?.success as ColorResolvable, fields: [ { - name: "Your balance" as string, + name: 'Your balance' as string, value: `${creditNoun(userDB?.credits)}` as string, }, ], - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, diff --git a/src/commands/utilities/index.ts b/src/commands/utilities/index.ts index 4170650..ac00d68 100644 --- a/src/commands/utilities/index.ts +++ b/src/commands/utilities/index.ts @@ -1,57 +1,57 @@ // Dependencies -import { SlashCommandBuilder } from "@discordjs/builders"; -import { CommandInteraction } from "discord.js"; +import { SlashCommandBuilder } from '@discordjs/builders'; +import { CommandInteraction } from 'discord.js'; // Modules -import lookup from "./modules/lookup"; -import about from "./modules/about"; -import stats from "./modules/stats"; +import lookup from './modules/lookup'; +import about from './modules/about'; +import stats from './modules/stats'; // Handlers -import logger from "../../handlers/logger"; +import logger from '../../handlers/logger'; // Function export default { data: new SlashCommandBuilder() - .setName("utilities") - .setDescription("Common utilities.") + .setName('utilities') + .setDescription('Common utilities.') .addSubcommand((subcommand) => subcommand - .setName("lookup") + .setName('lookup') .setDescription( - "Lookup a domain or ip. (Request sent over HTTP, proceed with caution!)" + 'Lookup a domain or ip. (Request sent over HTTP, proceed with caution!)' ) .addStringOption((option) => option - .setName("query") - .setDescription("The query you want to look up.") + .setName('query') + .setDescription('The query you want to look up.') .setRequired(true) ) ) .addSubcommand((subcommand) => - subcommand.setName("about").setDescription("About this bot!)") + subcommand.setName('about').setDescription('About this bot!)') ) .addSubcommand((subcommand) => - subcommand.setName("stats").setDescription("Check bot statistics!)") + subcommand.setName('stats').setDescription('Check bot statistics!)') ), async execute(interaction: CommandInteraction) { // Destructure const { options, guild, user, commandName } = interaction; // Module - Lookup - if (options?.getSubcommand() === "lookup") { + if (options?.getSubcommand() === 'lookup') { // Execute Module - Lookup - return await lookup(interaction); + return lookup(interaction); } // Module - About - else if (options?.getSubcommand() === "about") { + else if (options?.getSubcommand() === 'about') { // Execute Module - About - return await about(interaction); + return about(interaction); } // Module - Stats - else if (options?.getSubcommand() === "stats") { + else if (options?.getSubcommand() === 'stats') { // Execute Module - Stats - return await stats(interaction); + return stats(interaction); } // Send debug message diff --git a/src/commands/utilities/modules/about.ts b/src/commands/utilities/modules/about.ts index 40f4e9b..c1ec6b3 100644 --- a/src/commands/utilities/modules/about.ts +++ b/src/commands/utilities/modules/about.ts @@ -1,13 +1,13 @@ // Dependencies -import { CommandInteraction, ColorResolvable } from "discord.js"; +import { CommandInteraction, ColorResolvable } from 'discord.js'; // Configurations -import config from "../../../../config.json"; +import config from '../../../../config.json'; // Function export default async (interaction: CommandInteraction) => { const interactionEmbed = { - title: ":hammer: Utilities [About]" as string, + title: ':hammer: Utilities [About]' as string, description: `This bot is hosted by ${ config?.hoster?.url ? `[${config?.hoster?.name}](${config?.hoster?.url})` @@ -16,7 +16,7 @@ export default async (interaction: CommandInteraction) => { If you are interested in contributing, then just [fork it](https://github.com/ZynerOrg/xyter) yourself, we :heart: Open Source.` as string, color: config?.colors?.success as ColorResolvable, - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, diff --git a/src/commands/utilities/modules/lookup.ts b/src/commands/utilities/modules/lookup.ts index 0a12893..7206e74 100644 --- a/src/commands/utilities/modules/lookup.ts +++ b/src/commands/utilities/modules/lookup.ts @@ -1,18 +1,18 @@ // Dependencies -import axios from "axios"; -import { CommandInteraction, ColorResolvable } from "discord.js"; +import axios from 'axios'; +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'; // Function export default async (interaction: CommandInteraction) => { const { options } = interaction; // Get lookup query - const query = options?.getString("query"); + const query = options?.getString('query'); // Make API request await axios @@ -22,13 +22,13 @@ export default async (interaction: CommandInteraction) => { // If successful ?.then(async (res) => { // If query failed - if (res?.data?.status === "fail") { + if (res?.data?.status === 'fail') { // Create embed object const embed = { - title: ":hammer: Utilities - Lookup" as string, + title: ':hammer: Utilities - Lookup' as string, description: `${res?.data?.message}: ${res?.data?.query}` as string, color: config?.colors?.error as ColorResolvable, - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, @@ -40,62 +40,62 @@ export default async (interaction: CommandInteraction) => { } // If query is successful - else if (res?.data?.status === "success") { + else if (res?.data?.status === 'success') { // Create embed object const embed = { - title: ":hammer: Utilities - Lookup" as string, + title: ':hammer: Utilities - Lookup' as string, fields: [ { - name: "AS" as string, - value: `${res?.data?.as || "Not available"}` as string, + name: 'AS' as string, + value: `${res?.data?.as || 'Not available'}` as string, }, { - name: "Country" as string, - value: `${res?.data?.country || "Not available"}` as string, + name: 'Country' as string, + value: `${res?.data?.country || 'Not available'}` as string, }, { - name: "Country Code" as string, - value: `${res?.data?.countryCode || "Not available"}` as string, + name: 'Country Code' as string, + value: `${res?.data?.countryCode || 'Not available'}` as string, }, { - name: "Region" as string, - value: `${res?.data?.region || "Not available"}` as string, + name: 'Region' as string, + value: `${res?.data?.region || 'Not available'}` as string, }, { - name: "Region Name" as string, - value: `${res?.data?.regionName || "Not available"}` as string, + name: 'Region Name' as string, + value: `${res?.data?.regionName || 'Not available'}` as string, }, { - name: "City" as string, - value: `${res?.data?.city || "Not available"}` as string, + name: 'City' as string, + value: `${res?.data?.city || 'Not available'}` as string, }, { - name: "ZIP Code" as string, - value: `${res?.data?.zip || "Not available"}` as string, + name: 'ZIP Code' as string, + value: `${res?.data?.zip || 'Not available'}` as string, }, { - name: "Latitude" as string, - value: `${res?.data?.lat || "Not available"}` as string, + name: 'Latitude' as string, + value: `${res?.data?.lat || 'Not available'}` as string, }, { - name: "Longitude" as string, - value: `${res?.data?.lon || "Not available"}` as string, + name: 'Longitude' as string, + value: `${res?.data?.lon || 'Not available'}` as string, }, { - name: "Timezone" as string, - value: `${res?.data?.timezone || "Not available"}` as string, + name: 'Timezone' as string, + value: `${res?.data?.timezone || 'Not available'}` as string, }, { - name: "ISP" as string, - value: `${res?.data?.isp || "Not available"}` as string, + name: 'ISP' as string, + value: `${res?.data?.isp || 'Not available'}` as string, }, { - name: "Organization" as string, - value: `${res?.data?.org || "Not available"}` as string, + name: 'Organization' as string, + value: `${res?.data?.org || 'Not available'}` as string, }, ], color: config?.colors?.success as ColorResolvable, - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, diff --git a/src/commands/utilities/modules/stats.ts b/src/commands/utilities/modules/stats.ts index bba06ba..e19da6f 100644 --- a/src/commands/utilities/modules/stats.ts +++ b/src/commands/utilities/modules/stats.ts @@ -1,5 +1,5 @@ -import config from "../../../../config.json"; -import { CommandInteraction, ColorResolvable } from "discord.js"; +import config from '../../../../config.json'; +import { CommandInteraction, ColorResolvable } from 'discord.js'; export default async (interaction: CommandInteraction) => { const { client } = interaction; if (client?.uptime === null) return; @@ -14,32 +14,32 @@ export default async (interaction: CommandInteraction) => { const uptime = `${days} days, ${hours} hours, ${minutes} minutes and ${seconds} seconds`; const interactionEmbed = { - title: ":hammer: Utilities - Stats" as string, + title: ':hammer: Utilities - Stats' as string, description: - "Below you can see a list of statistics about the bot." as string, + 'Below you can see a list of statistics about the bot.' as string, fields: [ { - name: "⏰ Latency" as string, + name: '⏰ Latency' as string, value: `${Date?.now() - interaction?.createdTimestamp} ms` as string, inline: true, }, { - name: "⏰ API Latency" as string, + name: '⏰ API Latency' as string, value: `${Math?.round(client?.ws?.ping)} ms` as string, inline: true, }, { - name: "⏰ Uptime" as string, + name: '⏰ Uptime' as string, value: `${uptime}` as string, inline: false, }, { - name: "📈 Guilds" as string, + name: '📈 Guilds' as string, value: `${client?.guilds?.cache?.size}` as string, inline: true, }, { - name: "📈 Users (non-unique)" as string, + name: '📈 Users (non-unique)' as string, value: `${client?.guilds?.cache?.reduce( (acc, guild) => acc + guild?.memberCount, 0 @@ -48,7 +48,7 @@ export default async (interaction: CommandInteraction) => { }, ], color: config?.colors?.success as ColorResolvable, - timestamp: new Date() as Date, + timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, text: config?.footer?.text as string, From 5119117355da45c65dc08cbe58ebcf66c1a09178 Mon Sep 17 00:00:00 2001 From: codefactor-io Date: Sun, 10 Apr 2022 20:20:31 +0000 Subject: [PATCH 7/7] [CodeFactor] Apply fixes --- src/commands/admin/counters/index.ts | 12 +- src/commands/admin/counters/modules/remove.ts | 12 +- src/commands/admin/credits/index.ts | 18 +-- 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 +++--- src/commands/admin/index.ts | 106 +++++++++--------- src/commands/counters/index.ts | 22 ++-- src/commands/counters/modules/view.ts | 12 +- src/commands/credits/index.ts | 50 ++++----- src/commands/credits/modules/balance.ts | 22 ++-- src/commands/credits/modules/gift.ts | 38 +++---- src/commands/credits/modules/top.ts | 12 +- src/commands/credits/modules/work.ts | 26 ++--- src/commands/profile/index.ts | 22 ++-- src/commands/profile/modules/view.ts | 18 +-- src/commands/reputation/modules/give.ts | 32 +++--- src/commands/settings/guild/addons/credits.ts | 36 +++--- src/commands/settings/guild/addons/points.ts | 28 ++--- .../settings/guild/addons/pterodactyl.ts | 16 +-- src/commands/settings/guild/index.ts | 22 ++-- .../settings/user/modules/appearance.ts | 16 +-- src/commands/shop/index.ts | 46 ++++---- src/commands/shop/modules/pterodactyl.ts | 56 ++++----- src/commands/shop/roles/modules/buy.ts | 24 ++-- src/commands/shop/roles/modules/cancel.ts | 20 ++-- src/commands/utilities/index.ts | 34 +++--- src/commands/utilities/modules/about.ts | 6 +- src/commands/utilities/modules/lookup.ts | 66 +++++------ src/commands/utilities/modules/stats.ts | 18 +-- 31 files changed, 451 insertions(+), 451 deletions(-) diff --git a/src/commands/admin/counters/index.ts b/src/commands/admin/counters/index.ts index 24ab5e2..fe635db 100644 --- a/src/commands/admin/counters/index.ts +++ b/src/commands/admin/counters/index.ts @@ -1,12 +1,12 @@ // Dependencies -import { CommandInteraction } from 'discord.js'; +import { CommandInteraction } from "discord.js"; // Handlers -import logger from '../../../handlers/logger'; +import logger from "../../../handlers/logger"; // Modules -import add from './modules/add'; -import remove from './modules/remove'; +import add from "./modules/add"; +import remove from "./modules/remove"; // Function export default async (interaction: CommandInteraction) => { @@ -14,13 +14,13 @@ export default async (interaction: CommandInteraction) => { const { options, guild, user, commandName } = interaction; // Module - Add - if (options?.getSubcommand() === 'add') { + if (options?.getSubcommand() === "add") { // Execute Module - Add return add(interaction); } // Module - Remove - else if (options?.getSubcommand() === 'remove') { + else if (options?.getSubcommand() === "remove") { // Execute Module - Remove return remove(interaction); } diff --git a/src/commands/admin/counters/modules/remove.ts b/src/commands/admin/counters/modules/remove.ts index 720c170..d229b6e 100644 --- a/src/commands/admin/counters/modules/remove.ts +++ b/src/commands/admin/counters/modules/remove.ts @@ -1,14 +1,14 @@ // Dependencies -import { ColorResolvable, CommandInteraction } from 'discord.js'; +import { ColorResolvable, CommandInteraction } 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"; // Models -import counterSchema from '../../../../helpers/database/models/counterSchema'; +import counterSchema from "../../../../helpers/database/models/counterSchema"; // Function export default async (interaction: CommandInteraction) => { @@ -16,7 +16,7 @@ export default async (interaction: CommandInteraction) => { const { options, guild, user } = interaction; // Get options - const optionChannel = options?.getChannel('channel'); + const optionChannel = options?.getChannel("channel"); await counterSchema ?.deleteOne({ @@ -26,7 +26,7 @@ export default async (interaction: CommandInteraction) => { ?.then(async () => { // Embed object const embed = { - title: ':toolbox: Admin - Counters [Remove]' as string, + title: ":toolbox: Admin - Counters [Remove]" as string, description: `${optionChannel} is no longer an counting channel.`, timestamp: new Date(), color: config?.colors?.success as ColorResolvable, diff --git a/src/commands/admin/credits/index.ts b/src/commands/admin/credits/index.ts index 54a260b..1eddcde 100644 --- a/src/commands/admin/credits/index.ts +++ b/src/commands/admin/credits/index.ts @@ -1,11 +1,11 @@ // Dependencies -import { CommandInteraction } from 'discord.js'; +import { CommandInteraction } from "discord.js"; // Modules -import give from './modules/give'; -import take from './modules/take'; -import set from './modules/set'; -import transfer from './modules/transfer'; +import give from "./modules/give"; +import take from "./modules/take"; +import set from "./modules/set"; +import transfer from "./modules/transfer"; // Function export default async (interaction: CommandInteraction) => { @@ -13,25 +13,25 @@ export default async (interaction: CommandInteraction) => { const { options } = interaction; // Module - Give - if (options?.getSubcommand() === 'give') { + if (options?.getSubcommand() === "give") { // Execute Module - Give return give(interaction); } // Module - Take - else if (options?.getSubcommand() === 'take') { + else if (options?.getSubcommand() === "take") { // Execute Module - Take return take(interaction); } // Module - Set - else if (options?.getSubcommand() === 'set') { + else if (options?.getSubcommand() === "set") { // Execute Module - Set return set(interaction); } // Module - Transfer - else if (options?.getSubcommand() === 'transfer') { + else if (options?.getSubcommand() === "transfer") { // Execute Module - Transfer return transfer(interaction); } diff --git a/src/commands/admin/credits/modules/give.ts b/src/commands/admin/credits/modules/give.ts index 5d1f515..caaa967 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) { // 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 e935c15..2321680 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) { // 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 b43b21b..08dae69 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) { // 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 6213a42..e981b62 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) { // 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}.`, diff --git a/src/commands/admin/index.ts b/src/commands/admin/index.ts index 369c35f..8dd14fc 100644 --- a/src/commands/admin/index.ts +++ b/src/commands/admin/index.ts @@ -1,133 +1,133 @@ //Dependencies -import { SlashCommandBuilder } from '@discordjs/builders'; -import { CommandInteraction, ColorResolvable, Permissions } from 'discord.js'; +import { SlashCommandBuilder } from "@discordjs/builders"; +import { CommandInteraction, ColorResolvable, Permissions } 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"; // Groups -import credits from './credits'; -import counters from './counters'; +import credits from "./credits"; +import counters from "./counters"; // Function export default { data: new SlashCommandBuilder() - .setName('admin') - .setDescription('Admin actions.') + .setName("admin") + .setDescription("Admin actions.") .addSubcommandGroup((group) => group - .setName('credits') - .setDescription('Manage credits.') + .setName("credits") + .setDescription("Manage credits.") .addSubcommand((command) => command - .setName('give') - .setDescription('Give credits to a user') + .setName("give") + .setDescription("Give credits to a user") .addUserOption((option) => option - .setName('user') - .setDescription('The user you want to pay.') + .setName("user") + .setDescription("The user you want to pay.") .setRequired(true) ) .addIntegerOption((option) => option - .setName('amount') - .setDescription('The amount you will pay.') + .setName("amount") + .setDescription("The amount you will pay.") .setRequired(true) ) ) .addSubcommand((command) => command - .setName('set') - .setDescription('Set credits to a user') + .setName("set") + .setDescription("Set credits to a user") .addUserOption((option) => option - .setName('user') - .setDescription('The user you want to set credits on.') + .setName("user") + .setDescription("The user you want to set credits on.") .setRequired(true) ) .addIntegerOption((option) => option - .setName('amount') - .setDescription('The amount you will set.') + .setName("amount") + .setDescription("The amount you will set.") .setRequired(true) ) ) .addSubcommand((command) => command - .setName('take') - .setDescription('Take credits from a user') + .setName("take") + .setDescription("Take credits from a user") .addUserOption((option) => option - .setName('user') - .setDescription('The user you want to take credits from.') + .setName("user") + .setDescription("The user you want to take credits from.") .setRequired(true) ) .addIntegerOption((option) => option - .setName('amount') - .setDescription('The amount you will take.') + .setName("amount") + .setDescription("The amount you will take.") .setRequired(true) ) ) .addSubcommand((command) => command - .setName('transfer') - .setDescription('Transfer credits from a user to another user.') + .setName("transfer") + .setDescription("Transfer credits from a user to another user.") .addUserOption((option) => option - .setName('from') - .setDescription('The user you want to take credits from.') + .setName("from") + .setDescription("The user you want to take credits from.") .setRequired(true) ) .addUserOption((option) => option - .setName('to') - .setDescription('The user you want to give credits to.') + .setName("to") + .setDescription("The user you want to give credits to.") .setRequired(true) ) .addIntegerOption((option) => option - .setName('amount') - .setDescription('The amount you will transfer.') + .setName("amount") + .setDescription("The amount you will transfer.") .setRequired(true) ) ) ) .addSubcommandGroup((group) => group - .setName('counters') - .setDescription('Manage counters.') + .setName("counters") + .setDescription("Manage counters.") .addSubcommand((command) => command - .setName('add') - .setDescription('Add a counter') + .setName("add") + .setDescription("Add a counter") .addChannelOption((option) => option - .setName('channel') - .setDescription('The counter channel.') + .setName("channel") + .setDescription("The counter channel.") .setRequired(true) ) .addStringOption((option) => option - .setName('word') - .setDescription('The counter word.') + .setName("word") + .setDescription("The counter word.") .setRequired(true) ) .addNumberOption((option) => - option.setName('start').setDescription('Start at number X.') + option.setName("start").setDescription("Start at number X.") ) ) .addSubcommand((command) => command - .setName('remove') - .setDescription('Remove a counter') + .setName("remove") + .setDescription("Remove a counter") .addChannelOption((option) => option - .setName('channel') - .setDescription('The counter channel.') + .setName("channel") + .setDescription("The counter channel.") .setRequired(true) ) ) @@ -141,9 +141,9 @@ export default { if (!memberPermissions?.has(Permissions?.FLAGS?.MANAGE_GUILD)) { // Embed object const embed = { - title: ':toolbox: Admin' as string, + title: ":toolbox: Admin" as string, color: config?.colors?.error as ColorResolvable, - description: 'You do not have permission to manage this!' as string, + description: "You do not have permission to manage this!" as string, timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, @@ -156,13 +156,13 @@ export default { } // Group - Credits - if (options?.getSubcommandGroup() === 'credits') { + if (options?.getSubcommandGroup() === "credits") { // Execute Group - Credits return credits(interaction); } // Group - Counters - else if (options?.getSubcommandGroup() === 'counters') { + else if (options?.getSubcommandGroup() === "counters") { // Execute Group - Counters return counters(interaction); } diff --git a/src/commands/counters/index.ts b/src/commands/counters/index.ts index 2efb1f4..3d3542e 100644 --- a/src/commands/counters/index.ts +++ b/src/commands/counters/index.ts @@ -1,26 +1,26 @@ // Dependencies -import { CommandInteraction } from 'discord.js'; -import { SlashCommandBuilder } from '@discordjs/builders'; +import { CommandInteraction } from "discord.js"; +import { SlashCommandBuilder } from "@discordjs/builders"; // Modules -import view from './modules/view'; +import view from "./modules/view"; // Handlers -import logger from '../../handlers/logger'; +import logger from "../../handlers/logger"; // Function export default { data: new SlashCommandBuilder() - .setName('counters') - .setDescription('Manage counters.') + .setName("counters") + .setDescription("Manage counters.") .addSubcommand((subcommand) => subcommand - .setName('view') - .setDescription('View a counter.') + .setName("view") + .setDescription("View a counter.") .addChannelOption((option) => option - .setName('channel') - .setDescription('The counter channel you want to view') + .setName("channel") + .setDescription("The counter channel you want to view") .setRequired(true) ) ), @@ -28,7 +28,7 @@ export default { const { options, guild, user, commandName } = interaction; // Module - View - if (options?.getSubcommand() === 'view') { + if (options?.getSubcommand() === "view") { // Execute Module - View return view(interaction); } diff --git a/src/commands/counters/modules/view.ts b/src/commands/counters/modules/view.ts index 3b06480..75fa4c5 100644 --- a/src/commands/counters/modules/view.ts +++ b/src/commands/counters/modules/view.ts @@ -1,11 +1,11 @@ // Dependencies -import { CommandInteraction, ColorResolvable } from 'discord.js'; +import { CommandInteraction, ColorResolvable } from "discord.js"; // Configurations -import config from '../../../../config.json'; +import config from "../../../../config.json"; // Models -import counterSchema from '../../../helpers/database/models/counterSchema'; +import counterSchema from "../../../helpers/database/models/counterSchema"; // Function export default async (interaction: CommandInteraction) => { @@ -13,7 +13,7 @@ export default async (interaction: CommandInteraction) => { const { options, guild } = interaction; // Get options - const optionChannel = options?.getChannel('channel'); + const optionChannel = options?.getChannel("channel"); const counter = await counterSchema?.findOne({ guildId: guild?.id, @@ -23,7 +23,7 @@ export default async (interaction: CommandInteraction) => { if (!counter) { // Create embed object const embed = { - title: ':1234: Counters [View]' as string, + title: ":1234: Counters [View]" as string, description: `${optionChannel} is not a counting channel.` as string, timestamp: new Date(), color: config?.colors?.error as ColorResolvable, @@ -39,7 +39,7 @@ export default async (interaction: CommandInteraction) => { // Embed object const embed = { - title: ':1234: Counters [View]' as string, + title: ":1234: Counters [View]" as string, color: config.colors.success as ColorResolvable, description: `${optionChannel} is currently at number ${counter?.counter}.`, timestamp: new Date(), diff --git a/src/commands/credits/index.ts b/src/commands/credits/index.ts index 92e2ea4..dca9c4d 100644 --- a/src/commands/credits/index.ts +++ b/src/commands/credits/index.ts @@ -1,81 +1,81 @@ // Dependencies -import { SlashCommandBuilder } from '@discordjs/builders'; -import { CommandInteraction } from 'discord.js'; +import { SlashCommandBuilder } from "@discordjs/builders"; +import { CommandInteraction } from "discord.js"; // Handlers -import logger from '../../handlers/logger'; +import logger from "../../handlers/logger"; // Modules -import balance from './modules/balance'; -import gift from './modules/gift'; -import top from './modules/top'; -import work from './modules/work'; +import balance from "./modules/balance"; +import gift from "./modules/gift"; +import top from "./modules/top"; +import work from "./modules/work"; // Function export default { data: new SlashCommandBuilder() - .setName('credits') - .setDescription('Manage your credits.') + .setName("credits") + .setDescription("Manage your credits.") .addSubcommand((subcommand) => subcommand - .setName('balance') + .setName("balance") .setDescription("Check a user's balance.") .addUserOption((option) => option - .setName('user') - .setDescription('The user whose balance you want to check.') + .setName("user") + .setDescription("The user whose balance you want to check.") .setRequired(false) ) ) .addSubcommand((subcommand) => subcommand - .setName('gift') - .setDescription('Gift someone credits from your credits.') + .setName("gift") + .setDescription("Gift someone credits from your credits.") .addUserOption((option) => option - .setName('user') - .setDescription('The user you want to pay.') + .setName("user") + .setDescription("The user you want to pay.") .setRequired(true) ) .addIntegerOption((option) => option - .setName('amount') - .setDescription('The amount you will pay.') + .setName("amount") + .setDescription("The amount you will pay.") .setRequired(true) ) .addStringOption((option) => - option.setName('reason').setDescription('Your reason.') + option.setName("reason").setDescription("Your reason.") ) ) .addSubcommand((subcommand) => - subcommand.setName('top').setDescription('Check the top balance.') + subcommand.setName("top").setDescription("Check the top balance.") ) .addSubcommand((subcommand) => - subcommand.setName('work').setDescription('Work for credits.') + subcommand.setName("work").setDescription("Work for credits.") ), async execute(interaction: CommandInteraction) { const { options, user, guild, commandName } = interaction; // Module - Balance - if (options?.getSubcommand() === 'balance') { + if (options?.getSubcommand() === "balance") { // Execute Module - Balance return balance(interaction); } // Module - Gift - else if (options?.getSubcommand() === 'gift') { + else if (options?.getSubcommand() === "gift") { // Execute Module - Gift return gift(interaction); } // Module - Top - else if (options?.getSubcommand() === 'top') { + else if (options?.getSubcommand() === "top") { // Execute Module - Top return top(interaction); } // Module - Work - else if (options?.getSubcommand() === 'work') { + else if (options?.getSubcommand() === "work") { // Execute Module - Work return work(interaction); } diff --git a/src/commands/credits/modules/balance.ts b/src/commands/credits/modules/balance.ts index c3c4c3d..ec1fc03 100644 --- a/src/commands/credits/modules/balance.ts +++ b/src/commands/credits/modules/balance.ts @@ -1,14 +1,14 @@ // Dependencies -import { CommandInteraction, ColorResolvable } from 'discord.js'; +import { CommandInteraction, ColorResolvable } from "discord.js"; // Configurations -import config from '../../../../config.json'; +import config from "../../../../config.json"; // 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) => { @@ -16,7 +16,7 @@ export default async (interaction: CommandInteraction) => { const { options, user, guild } = interaction; // User option - const optionUser = options?.getUser('user'); + const optionUser = options?.getUser("user"); if (guild === null) return; @@ -27,9 +27,9 @@ export default async (interaction: CommandInteraction) => { if (userDB === null) { // Embed object const embed = { - title: ':dollar: Credits [Balance]' as string, + title: ":dollar: Credits [Balance]" as string, description: `We can not find ${ - optionUser || 'you' + optionUser || "you" } in our database.` as string, color: config?.colors?.error as ColorResolvable, timestamp: new Date(), @@ -47,9 +47,9 @@ export default async (interaction: CommandInteraction) => { if (userDB.credits === null) { // Embed object const embed = { - title: ':dollar: Credits [Balance]' as string, + title: ":dollar: Credits [Balance]" as string, description: `We can not find credits for ${ - optionUser || 'you' + optionUser || "you" } in our database.` as string, color: config?.colors?.error as ColorResolvable, timestamp: new Date(), @@ -64,9 +64,9 @@ export default async (interaction: CommandInteraction) => { } else { // Embed object const embed = { - title: ':dollar: Credits [Balance]' as string, + title: ":dollar: Credits [Balance]" as string, description: `${ - optionUser ? `${optionUser} has` : 'You have' + optionUser ? `${optionUser} has` : "You have" } ${creditNoun(userDB.credits)}.` as string, color: config?.colors?.success as ColorResolvable, timestamp: new Date(), diff --git a/src/commands/credits/modules/gift.ts b/src/commands/credits/modules/gift.ts index 9baa19b..eea9201 100644 --- a/src/commands/credits/modules/gift.ts +++ b/src/commands/credits/modules/gift.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 saveUser from '../../../helpers/saveUser'; -import creditNoun from '../../../helpers/creditNoun'; +import saveUser from "../../../helpers/saveUser"; +import creditNoun from "../../../helpers/creditNoun"; // Models -import fetchUser from '../../../helpers/fetchUser'; +import fetchUser from "../../../helpers/fetchUser"; // Function export default async (interaction: CommandInteraction) => { @@ -20,13 +20,13 @@ export default async (interaction: CommandInteraction) => { const { options, user, guild, client } = 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"); // Reason option - const optionReason = options?.getString('reason'); + const optionReason = options?.getString("reason"); if (guild === null) return; if (optionUser === null) return; @@ -44,7 +44,7 @@ export default async (interaction: CommandInteraction) => { if (optionUser?.id === user?.id) { // Create embed object const embed = { - title: ':dollar: Credits [Gift]' as string, + title: ":dollar: Credits [Gift]" as string, description: "You can't pay yourself." as string, color: config?.colors?.error as ColorResolvable, timestamp: new Date(), @@ -62,8 +62,8 @@ export default async (interaction: CommandInteraction) => { if (optionAmount === null) { // Embed object const embed = { - title: ':dollar: Credits [Gift]' as string, - description: 'We could not read your requested amount.' as string, + title: ":dollar: Credits [Gift]" as string, + description: "We could not read your requested amount." as string, color: config?.colors?.error as ColorResolvable, timestamp: new Date(), footer: { @@ -80,7 +80,7 @@ export default async (interaction: CommandInteraction) => { if (optionAmount <= 0) { // Embed object const embed = { - title: ':dollar: Credits [Gift]' as string, + title: ":dollar: Credits [Gift]" as string, description: "You can't pay zero or below." as string, color: config?.colors?.error as ColorResolvable, timestamp: new Date(), @@ -98,7 +98,7 @@ export default async (interaction: CommandInteraction) => { if (fromUserDB?.credits < optionAmount) { // Embed object const embed = { - title: ':dollar: Credits [Gift]' as string, + title: ":dollar: Credits [Gift]" as string, description: `You have insufficient credits. Your credits is ${fromUserDB?.credits}` as string, color: config?.colors?.error as ColorResolvable, @@ -117,7 +117,7 @@ export default async (interaction: CommandInteraction) => { if (!toUserDB) { // Embed object const embed = { - title: ':dollar: Credits [Gift]' as string, + title: ":dollar: Credits [Gift]" as string, description: `That user has no credits, I can not gift credits to ${optionUser}` as string, color: config?.colors?.error as ColorResolvable, @@ -142,9 +142,9 @@ export default async (interaction: CommandInteraction) => { await saveUser(fromUserDB, toUserDB)?.then(async () => { // Interaction embed object const interactionEmbed = { - title: ':dollar: Credits [Gift]', + title: ":dollar: Credits [Gift]", description: `You sent ${creditNoun(optionAmount)} to ${optionUser}${ - optionReason ? ` with reason: ${optionReason}` : '' + optionReason ? ` with reason: ${optionReason}` : "" }. Your new credits is ${creditNoun(fromUserDB?.credits)}.`, color: config?.colors?.success as ColorResolvable, timestamp: new Date(), @@ -156,9 +156,9 @@ export default async (interaction: CommandInteraction) => { // DM embed object const dmEmbed = { - title: ':dollar: Credits [Gift]' as string, + title: ":dollar: Credits [Gift]" as string, description: `You received ${creditNoun(optionAmount)} from ${user}${ - optionReason ? ` with reason: ${optionReason}` : '' + optionReason ? ` with reason: ${optionReason}` : "" }. Your new credits is ${creditNoun(toUserDB?.credits)}.` as string, color: config?.colors?.success as ColorResolvable, timestamp: new Date(), diff --git a/src/commands/credits/modules/top.ts b/src/commands/credits/modules/top.ts index f5da21c..3198484 100644 --- a/src/commands/credits/modules/top.ts +++ b/src/commands/credits/modules/top.ts @@ -1,14 +1,14 @@ // Dependencies -import { CommandInteraction, ColorResolvable } from 'discord.js'; +import { CommandInteraction, ColorResolvable } from "discord.js"; // Configurations -import config from '../../../../config.json'; +import config from "../../../../config.json"; // Models -import userSchema from '../../../helpers/database/models/userSchema'; +import userSchema from "../../../helpers/database/models/userSchema"; // helpers -import creditNoun from '../../../helpers/creditNoun'; +import creditNoun from "../../../helpers/creditNoun"; // Function export default async (interaction: CommandInteraction) => { @@ -30,10 +30,10 @@ export default async (interaction: CommandInteraction) => { // Create embed object const embed = { - title: ':dollar: Credits [Top]' as string, + title: ":dollar: Credits [Top]" as string, description: `Below are the top ten.\n${topTen ?.map((x, index) => entry(x, index)) - ?.join('\n')}` as string, + ?.join("\n")}` as string, color: config?.colors?.success as ColorResolvable, timestamp: new Date(), footer: { diff --git a/src/commands/credits/modules/work.ts b/src/commands/credits/modules/work.ts index ff59b6b..064b870 100644 --- a/src/commands/credits/modules/work.ts +++ b/src/commands/credits/modules/work.ts @@ -1,20 +1,20 @@ // Dependencies -import { CommandInteraction, ColorResolvable } from 'discord.js'; -import Chance from 'chance'; +import { CommandInteraction, ColorResolvable } from "discord.js"; +import Chance from "chance"; // Configurations -import config from '../../../../config.json'; +import config from "../../../../config.json"; // Handlers -import logger from '../../../handlers/logger'; +import logger from "../../../handlers/logger"; // Models -import timeouts from '../../../helpers/database/models/timeoutSchema'; +import timeouts from "../../../helpers/database/models/timeoutSchema"; // Helpers -import creditNoun from '../../../helpers/creditNoun'; -import fetchUser from '../../../helpers/fetchUser'; -import fetchGuild from '../../../helpers/fetchGuild'; +import creditNoun from "../../../helpers/creditNoun"; +import fetchUser from "../../../helpers/fetchUser"; +import fetchGuild from "../../../helpers/fetchGuild"; // Function export default async (interaction: CommandInteraction) => { @@ -28,7 +28,7 @@ export default async (interaction: CommandInteraction) => { const isTimeout = await timeouts?.findOne({ guildId: guild?.id, userId: user?.id, - timeoutId: '2022-03-15-19-16', + timeoutId: "2022-03-15-19-16", }); if (guild === null) return; @@ -54,7 +54,7 @@ export default async (interaction: CommandInteraction) => { // Create embed object const embed = { - title: ':dollar: Credits [Work]' as string, + title: ":dollar: Credits [Work]" as string, description: `You have earned ${creditNoun(creditsEarned)}` as string, color: config?.colors?.success as ColorResolvable, timestamp: new Date(), @@ -72,7 +72,7 @@ export default async (interaction: CommandInteraction) => { await timeouts?.create({ guildId: guild?.id, userId: user?.id, - timeoutId: '2022-03-15-19-16', + timeoutId: "2022-03-15-19-16", }); setTimeout(async () => { @@ -87,13 +87,13 @@ export default async (interaction: CommandInteraction) => { await timeouts?.deleteOne({ guildId: guild?.id, userId: user?.id, - timeoutId: '2022-03-15-19-16', + timeoutId: "2022-03-15-19-16", }); }, guildDB?.credits?.workTimeout); } else { // Create embed object const embed = { - title: ':dollar: Credits [Work]' as string, + title: ":dollar: Credits [Work]" as string, description: `You have worked within the last ${ guildDB?.credits?.workTimeout / 1000 } seconds, you can not work now!` as string, diff --git a/src/commands/profile/index.ts b/src/commands/profile/index.ts index 96d3e77..9747c66 100644 --- a/src/commands/profile/index.ts +++ b/src/commands/profile/index.ts @@ -1,26 +1,26 @@ // Dependencies -import { SlashCommandBuilder } from '@discordjs/builders'; -import { CommandInteraction } from 'discord.js'; +import { SlashCommandBuilder } from "@discordjs/builders"; +import { CommandInteraction } from "discord.js"; // Modules -import view from './modules/view'; +import view from "./modules/view"; // Handlers -import logger from '../../handlers/logger'; +import logger from "../../handlers/logger"; // Function export default { data: new SlashCommandBuilder() - .setName('profile') - .setDescription('Check a profile.') + .setName("profile") + .setDescription("Check a profile.") .addSubcommand((subcommand) => subcommand - .setName('view') - .setDescription('View a profile.') + .setName("view") + .setDescription("View a profile.") .addUserOption((option) => option - .setName('target') - .setDescription('The profile you wish to view') + .setName("target") + .setDescription("The profile you wish to view") ) ), async execute(interaction: CommandInteraction) { @@ -28,7 +28,7 @@ export default { const { options, guild, user, commandName } = interaction; // Module - View - if (options?.getSubcommand() === 'view') { + if (options?.getSubcommand() === "view") { // Execute Module - View return view(interaction); } diff --git a/src/commands/profile/modules/view.ts b/src/commands/profile/modules/view.ts index bb190ef..16a3151 100644 --- a/src/commands/profile/modules/view.ts +++ b/src/commands/profile/modules/view.ts @@ -1,11 +1,11 @@ // Dependencies -import { CommandInteraction, ColorResolvable } from 'discord.js'; +import { CommandInteraction, ColorResolvable } from "discord.js"; // Configurations -import config from '../../../../config.json'; +import config from "../../../../config.json"; // Models -import fetchUser from '../../../helpers/fetchUser'; +import fetchUser from "../../../helpers/fetchUser"; // Function export default async (interaction: CommandInteraction) => { @@ -13,7 +13,7 @@ export default async (interaction: CommandInteraction) => { const { client, options, user, guild } = interaction; // Target information - const target = options?.getUser('target'); + const target = options?.getUser("target"); // Discord User Information const discordUser = await client?.users?.fetch( @@ -35,27 +35,27 @@ export default async (interaction: CommandInteraction) => { fields: [ { name: `:dollar: Credits` as string, - value: `${userObj?.credits || 'Not found'}` as string, + value: `${userObj?.credits || "Not found"}` as string, inline: true, }, { name: `:squeeze_bottle: Level` as string, - value: `${userObj?.level || 'Not found'}` as string, + value: `${userObj?.level || "Not found"}` as string, inline: true, }, { name: `:squeeze_bottle: Points` as string, - value: `${userObj?.points || 'Not found'}` as string, + value: `${userObj?.points || "Not found"}` as string, inline: true, }, { name: `:loudspeaker: Reputation` as string, - value: `${userObj?.reputation || 'Not found'}` as string, + value: `${userObj?.reputation || "Not found"}` as string, inline: true, }, { name: `:rainbow_flag: Language` as string, - value: `${userObj?.language || 'Not found'}` as string, + value: `${userObj?.language || "Not found"}` as string, inline: true, }, ], diff --git a/src/commands/reputation/modules/give.ts b/src/commands/reputation/modules/give.ts index 0fc31bf..21b816a 100644 --- a/src/commands/reputation/modules/give.ts +++ b/src/commands/reputation/modules/give.ts @@ -1,15 +1,15 @@ // 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"; // Models -import timeoutSchema from '../../../helpers/database/models/timeoutSchema'; -import fetchUser from '../../../helpers/fetchUser'; +import timeoutSchema from "../../../helpers/database/models/timeoutSchema"; +import fetchUser from "../../../helpers/fetchUser"; // Function export default async (interaction: CommandInteraction) => { @@ -17,10 +17,10 @@ export default async (interaction: CommandInteraction) => { const { options, user, guild } = interaction; // Target option - const optionTarget = options?.getUser('target'); + const optionTarget = options?.getUser("target"); // Type information - const optionType = options?.getString('type'); + const optionType = options?.getString("type"); if (guild === null) return; @@ -33,7 +33,7 @@ export default async (interaction: CommandInteraction) => { const isTimeout = await timeoutSchema?.findOne({ guildId: guild?.id, userId: user?.id, - timeoutId: '2022-04-10-16-42', + timeoutId: "2022-04-10-16-42", }); // If user is not on timeout @@ -42,8 +42,8 @@ export default async (interaction: CommandInteraction) => { if (optionTarget?.id === user?.id) { // Embed object const embed = { - title: ':loudspeaker: Reputation [Give]' as string, - description: 'You can not repute yourself.' as string, + title: ":loudspeaker: Reputation [Give]" as string, + description: "You can not repute yourself." as string, timestamp: new Date(), color: config?.colors?.error as ColorResolvable, footer: { @@ -57,12 +57,12 @@ export default async (interaction: CommandInteraction) => { } // If type is positive - if (optionType === 'positive') { + if (optionType === "positive") { userObj.reputation += 1; } // If type is negative - else if (optionType === 'negative') { + else if (optionType === "negative") { userObj.reputation -= 1; } @@ -70,7 +70,7 @@ export default async (interaction: CommandInteraction) => { await userObj?.save()?.then(async () => { // Embed object const embed = { - title: ':loudspeaker: Reputation [Give]' as string, + title: ":loudspeaker: Reputation [Give]" as string, description: `You have given ${optionTarget} a ${optionType} reputation!` as string, timestamp: new Date(), @@ -90,7 +90,7 @@ export default async (interaction: CommandInteraction) => { await timeoutSchema?.create({ guildId: guild?.id, userId: user?.id, - timeoutId: '2022-04-10-16-42', + timeoutId: "2022-04-10-16-42", }); // Return interaction reply return interaction?.editReply({ embeds: [embed] }); @@ -108,13 +108,13 @@ export default async (interaction: CommandInteraction) => { await timeoutSchema?.deleteOne({ guildId: guild?.id, userId: user?.id, - timeoutId: '2022-04-10-16-42', + timeoutId: "2022-04-10-16-42", }); }, config?.reputation?.timeout); } else { // Create embed object const embed = { - title: ':loudspeaker: Reputation [Give]' as string, + title: ":loudspeaker: Reputation [Give]" as string, description: `You have given reputation within the last ${ config?.reputation?.timeout / 1000 } seconds, you can not repute now!` as string, diff --git a/src/commands/settings/guild/addons/credits.ts b/src/commands/settings/guild/addons/credits.ts index 32cf20e..e1aab4f 100644 --- a/src/commands/settings/guild/addons/credits.ts +++ b/src/commands/settings/guild/addons/credits.ts @@ -1,14 +1,14 @@ // Dependencies -import { ColorResolvable, CommandInteraction } from 'discord.js'; +import { ColorResolvable, CommandInteraction } 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"; // Models -import guildSchema from '../../../../helpers/database/models/guildSchema'; +import guildSchema from "../../../../helpers/database/models/guildSchema"; // Function export default async (interaction: CommandInteraction) => { @@ -16,12 +16,12 @@ export default async (interaction: CommandInteraction) => { const { guild, user, options } = interaction; // Get options - const status = options?.getBoolean('status'); - const rate = options?.getNumber('rate'); - const timeout = options?.getNumber('timeout'); - const minimumLength = options?.getNumber('minimum-length'); - const workRate = options?.getNumber('work-rate'); - const workTimeout = options?.getNumber('work-timeout'); + const status = options?.getBoolean("status"); + const rate = options?.getNumber("rate"); + const timeout = options?.getNumber("timeout"); + const minimumLength = options?.getNumber("minimum-length"); + const workRate = options?.getNumber("work-rate"); + const workTimeout = options?.getNumber("work-timeout"); // Get guild object const guildDB = await guildSchema?.findOne({ @@ -44,37 +44,37 @@ export default async (interaction: CommandInteraction) => { await guildDB?.save()?.then(async () => { // Embed object const embed = { - title: ':tools: Settings - Guild [Credits]' as string, - description: 'Following settings is set!' as string, + title: ":tools: Settings - Guild [Credits]" as string, + description: "Following settings is set!" as string, color: config?.colors?.success as ColorResolvable, fields: [ { - name: '🤖 Status' as string, + name: "🤖 Status" as string, value: `${guildDB?.credits?.status}` as string, inline: true, }, { - name: '📈 Rate' as string, + name: "📈 Rate" as string, value: `${guildDB?.credits?.rate}` as string, inline: true, }, { - name: '📈 Work Rate' as string, + name: "📈 Work Rate" as string, value: `${guildDB?.credits?.workRate}` as string, inline: true, }, { - name: '🔨 Minimum Length' as string, + name: "🔨 Minimum Length" as string, value: `${guildDB?.credits?.minimumLength}` as string, inline: true, }, { - name: '⏰ Timeout' as string, + name: "⏰ Timeout" as string, value: `${guildDB?.credits?.timeout}` as string, inline: true, }, { - name: '⏰ Work Timeout' as string, + name: "⏰ Work Timeout" as string, value: `${guildDB?.credits?.workTimeout}` as string, inline: true, }, diff --git a/src/commands/settings/guild/addons/points.ts b/src/commands/settings/guild/addons/points.ts index 9a8a718..97dbb0f 100644 --- a/src/commands/settings/guild/addons/points.ts +++ b/src/commands/settings/guild/addons/points.ts @@ -1,14 +1,14 @@ // Dependencies -import { ColorResolvable, CommandInteraction } from 'discord.js'; +import { ColorResolvable, CommandInteraction } 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"; // Models -import guildSchema from '../../../../helpers/database/models/guildSchema'; +import guildSchema from "../../../../helpers/database/models/guildSchema"; // Function export default async (interaction: CommandInteraction) => { @@ -16,10 +16,10 @@ export default async (interaction: CommandInteraction) => { const { options, guild, user } = interaction; // Get options - const status = options?.getBoolean('status'); - const rate = options?.getNumber('rate'); - const timeout = options?.getNumber('timeout'); - const minimumLength = options?.getNumber('minimum-length'); + const status = options?.getBoolean("status"); + const rate = options?.getNumber("rate"); + const timeout = options?.getNumber("timeout"); + const minimumLength = options?.getNumber("minimum-length"); // Get guild object const guildDB = await guildSchema?.findOne({ @@ -38,27 +38,27 @@ export default async (interaction: CommandInteraction) => { await guildDB?.save()?.then(async () => { // Create embed object const embed = { - title: ':hammer: Settings - Guild [Points]' as string, - description: 'Following settings is set!' as string, + title: ":hammer: Settings - Guild [Points]" as string, + description: "Following settings is set!" as string, color: config.colors.success as ColorResolvable, fields: [ { - name: '🤖 Status' as string, + name: "🤖 Status" as string, value: `${guildDB?.points?.status}` as string, inline: true, }, { - name: '📈 Rate' as string, + name: "📈 Rate" as string, value: `${guildDB?.points?.rate}` as string, inline: true, }, { - name: '🔨 Minimum Length' as string, + name: "🔨 Minimum Length" as string, value: `${guildDB?.points?.minimumLength}` as string, inline: true, }, { - name: '⏰ Timeout' as string, + name: "⏰ Timeout" as string, value: `${guildDB?.points?.timeout}` as string, inline: true, }, diff --git a/src/commands/settings/guild/addons/pterodactyl.ts b/src/commands/settings/guild/addons/pterodactyl.ts index 32f7f0c..94d39fa 100644 --- a/src/commands/settings/guild/addons/pterodactyl.ts +++ b/src/commands/settings/guild/addons/pterodactyl.ts @@ -1,14 +1,14 @@ // Dependencies -import { ColorResolvable, CommandInteraction } from 'discord.js'; +import { ColorResolvable, CommandInteraction } 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"; // Models -import apiSchema from '../../../../helpers/database/models/apiSchema'; +import apiSchema from "../../../../helpers/database/models/apiSchema"; // Function export default async (interaction: CommandInteraction) => { @@ -16,8 +16,8 @@ export default async (interaction: CommandInteraction) => { const { options, guild, user } = interaction; // Get options - const url = options?.getString('url'); - const token = options?.getString('token'); + const url = options?.getString("url"); + const token = options?.getString("token"); // Update API credentials await apiSchema @@ -29,9 +29,9 @@ export default async (interaction: CommandInteraction) => { .then(async () => { // Embed object const embed = { - title: ':hammer: Settings - Guild [Pterodactyl]' as string, + title: ":hammer: Settings - Guild [Pterodactyl]" as string, color: config?.colors?.success as ColorResolvable, - description: 'Pterodactyl settings is saved!' as string, + description: "Pterodactyl settings is saved!" as string, timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, diff --git a/src/commands/settings/guild/index.ts b/src/commands/settings/guild/index.ts index 34e28b7..fcfa173 100644 --- a/src/commands/settings/guild/index.ts +++ b/src/commands/settings/guild/index.ts @@ -1,16 +1,16 @@ // Dependencies -import { Permissions, ColorResolvable, CommandInteraction } from 'discord.js'; +import { Permissions, ColorResolvable, CommandInteraction } 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"; // Modules -import pterodactyl from './addons/pterodactyl'; -import credits from './addons/credits'; -import points from './addons/points'; +import pterodactyl from "./addons/pterodactyl"; +import credits from "./addons/credits"; +import points from "./addons/points"; // Function export default async (interaction: CommandInteraction) => { @@ -21,9 +21,9 @@ export default async (interaction: CommandInteraction) => { if (!memberPermissions?.has(Permissions?.FLAGS?.MANAGE_GUILD)) { // Create embed object const embed = { - title: ':tools: Settings - Guild' as string, + title: ":tools: Settings - Guild" as string, color: config?.colors?.error as ColorResolvable, - description: 'You do not have permission to manage this!' as string, + description: "You do not have permission to manage this!" as string, timestamp: new Date(), footer: { iconURL: config?.footer?.icon as string, @@ -36,19 +36,19 @@ export default async (interaction: CommandInteraction) => { } // Module - Pterodactyl - if (options?.getSubcommand() === 'pterodactyl') { + if (options?.getSubcommand() === "pterodactyl") { // Execute Module - Pterodactyl return pterodactyl(interaction); } // Module - Credits - else if (options?.getSubcommand() === 'credits') { + else if (options?.getSubcommand() === "credits") { // Execute Module - Credits return credits(interaction); } // Module - Points - else if (options?.getSubcommand() === 'points') { + else if (options?.getSubcommand() === "points") { // Execute Module - Points return points(interaction); } diff --git a/src/commands/settings/user/modules/appearance.ts b/src/commands/settings/user/modules/appearance.ts index e3437f8..17ecb8a 100644 --- a/src/commands/settings/user/modules/appearance.ts +++ b/src/commands/settings/user/modules/appearance.ts @@ -1,14 +1,14 @@ // 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"; // Models -import fetchUser from '../../../../helpers/fetchUser'; +import fetchUser from "../../../../helpers/fetchUser"; // Function export default async (interaction: CommandInteraction) => { @@ -16,7 +16,7 @@ export default async (interaction: CommandInteraction) => { const { options, user, guild } = interaction; // Get options - const language = options?.getString('language'); + const language = options?.getString("language"); if (guild === null) return; @@ -32,12 +32,12 @@ export default async (interaction: CommandInteraction) => { await userDB?.save()?.then(async () => { // Embed object const embed = { - title: ':hammer: Settings - User [Appearance]' as string, - description: 'Following settings is set!' as string, + title: ":hammer: Settings - User [Appearance]" as string, + description: "Following settings is set!" as string, color: config?.colors?.success as ColorResolvable, fields: [ { - name: '🏳️‍🌈 Language' as string, + name: "🏳️‍🌈 Language" as string, value: `${userDB?.language}` as string, inline: true, }, diff --git a/src/commands/shop/index.ts b/src/commands/shop/index.ts index bab78f8..621d5cc 100644 --- a/src/commands/shop/index.ts +++ b/src/commands/shop/index.ts @@ -1,53 +1,53 @@ // Dependencies -import { SlashCommandBuilder } from '@discordjs/builders'; -import { CommandInteraction } from 'discord.js'; +import { SlashCommandBuilder } from "@discordjs/builders"; +import { CommandInteraction } from "discord.js"; // Modules -import pterodactyl from './modules/pterodactyl'; +import pterodactyl from "./modules/pterodactyl"; // Groups -import roles from './roles'; +import roles from "./roles"; // Handlers -import logger from '../../handlers/logger'; +import logger from "../../handlers/logger"; // Function export default { data: new SlashCommandBuilder() - .setName('shop') - .setDescription('Open our shop.') + .setName("shop") + .setDescription("Open our shop.") .addSubcommand((subcommand) => subcommand - .setName('pterodactyl') - .setDescription('Buy pterodactyl power.') + .setName("pterodactyl") + .setDescription("Buy pterodactyl power.") .addIntegerOption((option) => option - .setName('amount') - .setDescription('How much credits you want to withdraw.') + .setName("amount") + .setDescription("How much credits you want to withdraw.") ) ) .addSubcommandGroup((group) => group - .setName('roles') - .setDescription('Manage custom roles.') + .setName("roles") + .setDescription("Manage custom roles.") .addSubcommand((command) => command - .setName('buy') - .setDescription('Buy a custom role') + .setName("buy") + .setDescription("Buy a custom role") .addStringOption((option) => option - .setName('name') - .setDescription('Name of the role you wish to purchase.') + .setName("name") + .setDescription("Name of the role you wish to purchase.") ) ) .addSubcommand((command) => command - .setName('cancel') - .setDescription('Cancel a custom role') + .setName("cancel") + .setDescription("Cancel a custom role") .addRoleOption((option) => option - .setName('role') - .setDescription('Name of the role you wish to cancel.') + .setName("role") + .setDescription("Name of the role you wish to cancel.") ) ) ), @@ -56,13 +56,13 @@ export default { const { options, commandName, user, guild } = interaction; // Module - Pterodactyl - if (options?.getSubcommand() === 'pterodactyl') { + if (options?.getSubcommand() === "pterodactyl") { // Execute Module - Pterodactyl return pterodactyl(interaction); } // Group - Roles - else if (options?.getSubcommandGroup() === 'roles') { + else if (options?.getSubcommandGroup() === "roles") { // Execute Group - Roles return roles(interaction); } diff --git a/src/commands/shop/modules/pterodactyl.ts b/src/commands/shop/modules/pterodactyl.ts index aac47f0..8af6011 100644 --- a/src/commands/shop/modules/pterodactyl.ts +++ b/src/commands/shop/modules/pterodactyl.ts @@ -1,34 +1,34 @@ // Dependencies -import { CommandInteraction, ColorResolvable } from 'discord.js'; -import { v4 as uuidv4 } from 'uuid'; -import axios from 'axios'; +import { CommandInteraction, ColorResolvable } from "discord.js"; +import { v4 as uuidv4 } from "uuid"; +import axios from "axios"; // 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 apiSchema from '../../../helpers/database/models/apiSchema'; -import fetchUser from '../../../helpers/fetchUser'; +import apiSchema from "../../../helpers/database/models/apiSchema"; +import fetchUser from "../../../helpers/fetchUser"; // Function export default async (interaction: CommandInteraction) => { const { options, guild, user, client } = interaction; // Get options - const optionAmount = options?.getInteger('amount'); + const optionAmount = options?.getInteger("amount"); // If amount is null if (optionAmount === null) { // Embed object const embed = { - title: ':dollar: Credits [Gift]' as string, - description: 'We could not read your requested amount.' as string, + title: ":dollar: Credits [Gift]" as string, + description: "We could not read your requested amount." as string, color: config?.colors?.error as ColorResolvable, timestamp: new Date(), footer: { @@ -54,13 +54,13 @@ export default async (interaction: CommandInteraction) => { // Stop if amount or user credits is below 100 if ((optionAmount || userDB?.credits) < 100) { const embed = { - title: ':shopping_cart: Shop [Pterodactyl]' as string, + title: ":shopping_cart: Shop [Pterodactyl]" as string, description: `You **can't** withdraw for __Pterodactyl__ below **100**.` as string, color: config?.colors?.error as ColorResolvable, fields: [ { - name: 'Your balance' as string, + name: "Your balance" as string, value: `${creditNoun(userDB?.credits)}` as string, }, ], @@ -76,13 +76,13 @@ export default async (interaction: CommandInteraction) => { // Stop if amount or user credits is above 1.000.000 if ((optionAmount || userDB?.credits) > 1000000) { const embed = { - title: ':shopping_cart: Shop [Pterodactyl]' as string, + title: ":shopping_cart: Shop [Pterodactyl]" as string, description: `You **can't** withdraw for __Pterodactyl__ above **1.000.000**.` as string, color: config?.colors?.error as ColorResolvable, fields: [ { - name: 'Your balance' as string, + name: "Your balance" as string, value: `${creditNoun(userDB?.credits)}` as string, }, ], @@ -98,12 +98,12 @@ export default async (interaction: CommandInteraction) => { // Stop if user credits is below amount if (userDB?.credits < optionAmount) { const embed = { - title: ':shopping_cart: Shop [Pterodactyl]' as string, + title: ":shopping_cart: Shop [Pterodactyl]" as string, description: `You have **insufficient** credits.` as string, color: config.colors.error as ColorResolvable, fields: [ { - name: 'Your balance' as string, + name: "Your balance" as string, value: `${creditNoun(userDB?.credits)}` as string, }, ], @@ -131,13 +131,13 @@ export default async (interaction: CommandInteraction) => { }); // Get shop URL - const shopUrl = apiCredentials?.url?.replace('/api', '/store'); + const shopUrl = apiCredentials?.url?.replace("/api", "/store"); // Make API request await api // Make a post request to the API - ?.post('vouchers', { + ?.post("vouchers", { uses: 1, code, credits: optionAmount || userDB?.credits, @@ -148,12 +148,12 @@ export default async (interaction: CommandInteraction) => { ?.then(async () => { // Create DM embed object const dmEmbed = { - title: ':shopping_cart: Shop [Pterodactyl]' as string, + title: ":shopping_cart: Shop [Pterodactyl]" as string, description: `Redeem this voucher [here](${shopUrl})!` as string, fields: [ - { name: 'Code' as string, value: `${code}` as string, inline: true }, + { name: "Code" as string, value: `${code}` as string, inline: true }, { - name: 'Credits' as string, + name: "Credits" as string, value: `${optionAmount || userDB?.credits}` as string, inline: true, }, @@ -168,8 +168,8 @@ export default async (interaction: CommandInteraction) => { // Create interaction embed object const interactionEmbed = { - title: ':shopping_cart: Shop [Pterodactyl]' as string, - description: 'I have sent you the code in DM!' as string, + title: ":shopping_cart: Shop [Pterodactyl]" as string, + description: "I have sent you the code in DM!" as string, color: config?.colors?.success as ColorResolvable, timestamp: new Date(), footer: { @@ -204,9 +204,9 @@ export default async (interaction: CommandInteraction) => { .catch(async (e: any) => { logger?.error(e); const embed = { - title: ':shopping_cart: Shop [Pterodactyl]' as string, + title: ":shopping_cart: Shop [Pterodactyl]" as string, description: - 'Something went wrong, please try again later.' as string, + "Something went wrong, please try again later." as string, color: config?.colors?.error as ColorResolvable, timestamp: new Date(), footer: { @@ -222,8 +222,8 @@ export default async (interaction: CommandInteraction) => { .catch(async (e) => { logger?.error(e); const embed = { - title: ':shopping_cart: Shop [Pterodactyl]' as string, - description: 'Something went wrong, please try again later.' as string, + title: ":shopping_cart: Shop [Pterodactyl]" as string, + description: "Something went wrong, please try again later." as string, color: config?.colors?.error as ColorResolvable, timestamp: new Date(), footer: { diff --git a/src/commands/shop/roles/modules/buy.ts b/src/commands/shop/roles/modules/buy.ts index fc6cca1..533e68d 100644 --- a/src/commands/shop/roles/modules/buy.ts +++ b/src/commands/shop/roles/modules/buy.ts @@ -3,31 +3,31 @@ import { CommandInteraction, ColorResolvable, GuildMemberRoleManager, -} from 'discord.js'; +} from "discord.js"; // Configurations -import config from '../../../../../config.json'; +import config from "../../../../../config.json"; // Models -import shopRolesSchema from '../../../../helpers/database/models/shopRolesSchema'; -import guildSchema from '../../../../helpers/database/models/guildSchema'; +import shopRolesSchema from "../../../../helpers/database/models/shopRolesSchema"; +import guildSchema from "../../../../helpers/database/models/guildSchema"; // Helpers -import creditNoun from '../../../../helpers/creditNoun'; -import fetchUser from '../../../../helpers/fetchUser'; +import creditNoun from "../../../../helpers/creditNoun"; +import fetchUser from "../../../../helpers/fetchUser"; // Function export default async (interaction: CommandInteraction) => { const { options, guild, user, member } = interaction; - const optionName = options?.getString('name'); + const optionName = options?.getString("name"); // If amount is null if (optionName === null) { // Embed object const embed = { - title: ':dollar: Shop - Roles [Buy]' as string, - description: 'We could not read your requested name.' as string, + title: ":dollar: Shop - Roles [Buy]" as string, + description: "We could not read your requested name." as string, color: config?.colors?.error as ColorResolvable, timestamp: new Date(), footer: { @@ -43,7 +43,7 @@ export default async (interaction: CommandInteraction) => { await guild?.roles .create({ name: optionName, - color: 'RED', + color: "RED", reason: `${user?.id} bought from shop`, }) .then(async (role) => { @@ -74,13 +74,13 @@ export default async (interaction: CommandInteraction) => { await shopRolesSchema?.find()?.then((role: any) => console.log(role)); const embed = { - title: ':shopping_cart: Shop - Roles [Buy]' as string, + title: ":shopping_cart: Shop - Roles [Buy]" as string, description: `You have bought ${role?.name} for ${guildDB?.shop?.roles?.pricePerHour} per hour.` as string, color: config?.colors?.success as ColorResolvable, fields: [ { - name: 'Your balance' as string, + name: "Your balance" as string, value: `${creditNoun(userDB?.credits)}` as string, }, ], diff --git a/src/commands/shop/roles/modules/cancel.ts b/src/commands/shop/roles/modules/cancel.ts index d6a4a5b..66a0507 100644 --- a/src/commands/shop/roles/modules/cancel.ts +++ b/src/commands/shop/roles/modules/cancel.ts @@ -3,30 +3,30 @@ import { CommandInteraction, ColorResolvable, GuildMemberRoleManager, -} from 'discord.js'; +} from "discord.js"; // Configurations -import config from '../../../../../config.json'; +import config from "../../../../../config.json"; // Models -import shopRolesSchema from '../../../../helpers/database/models/shopRolesSchema'; +import shopRolesSchema from "../../../../helpers/database/models/shopRolesSchema"; // Helpers -import creditNoun from '../../../../helpers/creditNoun'; -import fetchUser from '../../../../helpers/fetchUser'; +import creditNoun from "../../../../helpers/creditNoun"; +import fetchUser from "../../../../helpers/fetchUser"; // Function export default async (interaction: CommandInteraction) => { const { options, guild, user, member } = interaction; - const optionRole = options.getRole('role'); + const optionRole = options.getRole("role"); // If amount is null if (optionRole === null) { // Embed object const embed = { - title: ':dollar: Shop - Roles [Cancel]' as string, - description: 'We could not read your requested role.' as string, + title: ":dollar: Shop - Roles [Cancel]" as string, + description: "We could not read your requested role." as string, color: config?.colors?.error as ColorResolvable, timestamp: new Date(), footer: { @@ -62,12 +62,12 @@ export default async (interaction: CommandInteraction) => { }); const embed = { - title: ':shopping_cart: Shop - Roles [Cancel]' as string, + title: ":shopping_cart: Shop - Roles [Cancel]" as string, description: `You have canceled ${optionRole.name}.` as string, color: config?.colors?.success as ColorResolvable, fields: [ { - name: 'Your balance' as string, + name: "Your balance" as string, value: `${creditNoun(userDB?.credits)}` as string, }, ], diff --git a/src/commands/utilities/index.ts b/src/commands/utilities/index.ts index ac00d68..9e009a3 100644 --- a/src/commands/utilities/index.ts +++ b/src/commands/utilities/index.ts @@ -1,55 +1,55 @@ // Dependencies -import { SlashCommandBuilder } from '@discordjs/builders'; -import { CommandInteraction } from 'discord.js'; +import { SlashCommandBuilder } from "@discordjs/builders"; +import { CommandInteraction } from "discord.js"; // Modules -import lookup from './modules/lookup'; -import about from './modules/about'; -import stats from './modules/stats'; +import lookup from "./modules/lookup"; +import about from "./modules/about"; +import stats from "./modules/stats"; // Handlers -import logger from '../../handlers/logger'; +import logger from "../../handlers/logger"; // Function export default { data: new SlashCommandBuilder() - .setName('utilities') - .setDescription('Common utilities.') + .setName("utilities") + .setDescription("Common utilities.") .addSubcommand((subcommand) => subcommand - .setName('lookup') + .setName("lookup") .setDescription( - 'Lookup a domain or ip. (Request sent over HTTP, proceed with caution!)' + "Lookup a domain or ip. (Request sent over HTTP, proceed with caution!)" ) .addStringOption((option) => option - .setName('query') - .setDescription('The query you want to look up.') + .setName("query") + .setDescription("The query you want to look up.") .setRequired(true) ) ) .addSubcommand((subcommand) => - subcommand.setName('about').setDescription('About this bot!)') + subcommand.setName("about").setDescription("About this bot!)") ) .addSubcommand((subcommand) => - subcommand.setName('stats').setDescription('Check bot statistics!)') + subcommand.setName("stats").setDescription("Check bot statistics!)") ), async execute(interaction: CommandInteraction) { // Destructure const { options, guild, user, commandName } = interaction; // Module - Lookup - if (options?.getSubcommand() === 'lookup') { + if (options?.getSubcommand() === "lookup") { // Execute Module - Lookup return lookup(interaction); } // Module - About - else if (options?.getSubcommand() === 'about') { + else if (options?.getSubcommand() === "about") { // Execute Module - About return about(interaction); } // Module - Stats - else if (options?.getSubcommand() === 'stats') { + else if (options?.getSubcommand() === "stats") { // Execute Module - Stats return stats(interaction); } diff --git a/src/commands/utilities/modules/about.ts b/src/commands/utilities/modules/about.ts index c1ec6b3..e76779e 100644 --- a/src/commands/utilities/modules/about.ts +++ b/src/commands/utilities/modules/about.ts @@ -1,13 +1,13 @@ // Dependencies -import { CommandInteraction, ColorResolvable } from 'discord.js'; +import { CommandInteraction, ColorResolvable } from "discord.js"; // Configurations -import config from '../../../../config.json'; +import config from "../../../../config.json"; // Function export default async (interaction: CommandInteraction) => { const interactionEmbed = { - title: ':hammer: Utilities [About]' as string, + title: ":hammer: Utilities [About]" as string, description: `This bot is hosted by ${ config?.hoster?.url ? `[${config?.hoster?.name}](${config?.hoster?.url})` diff --git a/src/commands/utilities/modules/lookup.ts b/src/commands/utilities/modules/lookup.ts index 7206e74..b997eb4 100644 --- a/src/commands/utilities/modules/lookup.ts +++ b/src/commands/utilities/modules/lookup.ts @@ -1,18 +1,18 @@ // Dependencies -import axios from 'axios'; -import { CommandInteraction, ColorResolvable } from 'discord.js'; +import axios from "axios"; +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"; // Function export default async (interaction: CommandInteraction) => { const { options } = interaction; // Get lookup query - const query = options?.getString('query'); + const query = options?.getString("query"); // Make API request await axios @@ -22,10 +22,10 @@ export default async (interaction: CommandInteraction) => { // If successful ?.then(async (res) => { // If query failed - if (res?.data?.status === 'fail') { + if (res?.data?.status === "fail") { // Create embed object const embed = { - title: ':hammer: Utilities - Lookup' as string, + title: ":hammer: Utilities - Lookup" as string, description: `${res?.data?.message}: ${res?.data?.query}` as string, color: config?.colors?.error as ColorResolvable, timestamp: new Date(), @@ -40,58 +40,58 @@ export default async (interaction: CommandInteraction) => { } // If query is successful - else if (res?.data?.status === 'success') { + else if (res?.data?.status === "success") { // Create embed object const embed = { - title: ':hammer: Utilities - Lookup' as string, + title: ":hammer: Utilities - Lookup" as string, fields: [ { - name: 'AS' as string, - value: `${res?.data?.as || 'Not available'}` as string, + name: "AS" as string, + value: `${res?.data?.as || "Not available"}` as string, }, { - name: 'Country' as string, - value: `${res?.data?.country || 'Not available'}` as string, + name: "Country" as string, + value: `${res?.data?.country || "Not available"}` as string, }, { - name: 'Country Code' as string, - value: `${res?.data?.countryCode || 'Not available'}` as string, + name: "Country Code" as string, + value: `${res?.data?.countryCode || "Not available"}` as string, }, { - name: 'Region' as string, - value: `${res?.data?.region || 'Not available'}` as string, + name: "Region" as string, + value: `${res?.data?.region || "Not available"}` as string, }, { - name: 'Region Name' as string, - value: `${res?.data?.regionName || 'Not available'}` as string, + name: "Region Name" as string, + value: `${res?.data?.regionName || "Not available"}` as string, }, { - name: 'City' as string, - value: `${res?.data?.city || 'Not available'}` as string, + name: "City" as string, + value: `${res?.data?.city || "Not available"}` as string, }, { - name: 'ZIP Code' as string, - value: `${res?.data?.zip || 'Not available'}` as string, + name: "ZIP Code" as string, + value: `${res?.data?.zip || "Not available"}` as string, }, { - name: 'Latitude' as string, - value: `${res?.data?.lat || 'Not available'}` as string, + name: "Latitude" as string, + value: `${res?.data?.lat || "Not available"}` as string, }, { - name: 'Longitude' as string, - value: `${res?.data?.lon || 'Not available'}` as string, + name: "Longitude" as string, + value: `${res?.data?.lon || "Not available"}` as string, }, { - name: 'Timezone' as string, - value: `${res?.data?.timezone || 'Not available'}` as string, + name: "Timezone" as string, + value: `${res?.data?.timezone || "Not available"}` as string, }, { - name: 'ISP' as string, - value: `${res?.data?.isp || 'Not available'}` as string, + name: "ISP" as string, + value: `${res?.data?.isp || "Not available"}` as string, }, { - name: 'Organization' as string, - value: `${res?.data?.org || 'Not available'}` as string, + name: "Organization" as string, + value: `${res?.data?.org || "Not available"}` as string, }, ], color: config?.colors?.success as ColorResolvable, diff --git a/src/commands/utilities/modules/stats.ts b/src/commands/utilities/modules/stats.ts index e19da6f..9463d71 100644 --- a/src/commands/utilities/modules/stats.ts +++ b/src/commands/utilities/modules/stats.ts @@ -1,5 +1,5 @@ -import config from '../../../../config.json'; -import { CommandInteraction, ColorResolvable } from 'discord.js'; +import config from "../../../../config.json"; +import { CommandInteraction, ColorResolvable } from "discord.js"; export default async (interaction: CommandInteraction) => { const { client } = interaction; if (client?.uptime === null) return; @@ -14,32 +14,32 @@ export default async (interaction: CommandInteraction) => { const uptime = `${days} days, ${hours} hours, ${minutes} minutes and ${seconds} seconds`; const interactionEmbed = { - title: ':hammer: Utilities - Stats' as string, + title: ":hammer: Utilities - Stats" as string, description: - 'Below you can see a list of statistics about the bot.' as string, + "Below you can see a list of statistics about the bot." as string, fields: [ { - name: '⏰ Latency' as string, + name: "⏰ Latency" as string, value: `${Date?.now() - interaction?.createdTimestamp} ms` as string, inline: true, }, { - name: '⏰ API Latency' as string, + name: "⏰ API Latency" as string, value: `${Math?.round(client?.ws?.ping)} ms` as string, inline: true, }, { - name: '⏰ Uptime' as string, + name: "⏰ Uptime" as string, value: `${uptime}` as string, inline: false, }, { - name: '📈 Guilds' as string, + name: "📈 Guilds" as string, value: `${client?.guilds?.cache?.size}` as string, inline: true, }, { - name: '📈 Users (non-unique)' as string, + name: "📈 Users (non-unique)" as string, value: `${client?.guilds?.cache?.reduce( (acc, guild) => acc + guild?.memberCount, 0