From e5d932453339eab1f41fbad2dcfc3c6b8a5e93d1 Mon Sep 17 00:00:00 2001 From: Vermium Sifell Date: Fri, 14 Oct 2022 13:46:47 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Fixed=20som?= =?UTF-8?q?e=20more=20code=20smells?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../events/interactionCreate/handlers/button/index.ts | 5 ++--- .../events/interactionCreate/handlers/command/index.ts | 5 ++--- src/plugins/events/interactionCreate/index.ts | 8 +++----- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/plugins/events/interactionCreate/handlers/button/index.ts b/src/plugins/events/interactionCreate/handlers/button/index.ts index 04d524e..8fac9dd 100644 --- a/src/plugins/events/interactionCreate/handlers/button/index.ts +++ b/src/plugins/events/interactionCreate/handlers/button/index.ts @@ -1,7 +1,6 @@ // Dependencies import { BaseInteraction } from "discord.js"; - -import * as cooldown from "../../../../../helpers/cooldown"; +import { button as CooldownButton } from "../../../../../helpers/cooldown"; import deferReply from "../../../../../helpers/deferReply"; export default async (interaction: BaseInteraction) => { @@ -30,7 +29,7 @@ export default async (interaction: BaseInteraction) => { if (metadata.dmOnly && guild) throw new Error("This command is only available in DM"); - if (metadata.cooldown) await cooldown.button(interaction, metadata.cooldown); + if (metadata.cooldown) await CooldownButton(interaction, metadata.cooldown); await currentButton.execute(interaction); }; diff --git a/src/plugins/events/interactionCreate/handlers/command/index.ts b/src/plugins/events/interactionCreate/handlers/command/index.ts index acc53b0..4e9cc59 100644 --- a/src/plugins/events/interactionCreate/handlers/command/index.ts +++ b/src/plugins/events/interactionCreate/handlers/command/index.ts @@ -1,7 +1,6 @@ // Dependencies import { ChatInputCommandInteraction } from "discord.js"; - -import * as cooldown from "../../../../../helpers/cooldown"; +import { command as CooldownCommand } from "../../../../../helpers/cooldown"; import deferReply from "../../../../../helpers/deferReply"; import getCommandMetadata from "../../../../../helpers/getCommandMetadata"; @@ -29,7 +28,7 @@ export default async (interaction: ChatInputCommandInteraction) => { throw new Error("This command is only available in DM"); if (metadata.cooldown) { - await cooldown.command(interaction, metadata.cooldown); + await CooldownCommand(interaction, metadata.cooldown); } await currentCommand.execute(interaction); }; diff --git a/src/plugins/events/interactionCreate/index.ts b/src/plugins/events/interactionCreate/index.ts index 49599e6..11a715c 100644 --- a/src/plugins/events/interactionCreate/index.ts +++ b/src/plugins/events/interactionCreate/index.ts @@ -4,13 +4,11 @@ import { CommandInteraction, InteractionType, } from "discord.js"; - -// Dependencies -import * as handlers from "./handlers"; - import { IEventOptions } from "../../../interfaces/EventOptions"; import logger from "../../../middlewares/logger"; import audits from "./audits"; +// Dependencies +import { handleCommandInteraction as HandlersHandleCommandInteraction } from "./handlers"; export const options: IEventOptions = { type: "on", @@ -27,7 +25,7 @@ export const execute = async (interaction: BaseInteraction) => { switch (interaction.type) { case InteractionType.ApplicationCommand: - await handlers.handleCommandInteraction(interaction); + await HandlersHandleCommandInteraction(interaction); break; default: