From 8b8c50551f223c0f3d23eb40023dc4bd6da5634c Mon Sep 17 00:00:00 2001 From: Taken Date: Sat, 24 Aug 2024 22:59:02 +0200 Subject: [PATCH] Remove extra declaration --- src/utils/Events/autocomplete.ts | 3 +-- src/utils/Events/button.ts | 3 +-- src/utils/Events/command.ts | 3 +-- src/utils/Events/contextmenu.ts | 3 +-- src/utils/Events/cron.ts | 3 +-- src/utils/Events/events.ts | 3 +-- src/utils/Events/modal.ts | 3 +-- 7 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/utils/Events/autocomplete.ts b/src/utils/Events/autocomplete.ts index b1a01d4..db5d5e4 100644 --- a/src/utils/Events/autocomplete.ts +++ b/src/utils/Events/autocomplete.ts @@ -15,8 +15,7 @@ export default async function loadAutocompleteEvents(client: Client, ft: FileTyp for (const file of autocompleteFiles) { const filePath = path.join(autocompletePath, file) - const { default: autocompleteImport } = await import("file://" + filePath) - const autocomplete: IAutocomplete = autocompleteImport + const { default: autocomplete } = await import("file://" + filePath) as { default: IAutocomplete } if ("name" in autocomplete && "execute" in autocomplete) { client.autocomplete.set(autocomplete.name, autocomplete) diff --git a/src/utils/Events/button.ts b/src/utils/Events/button.ts index c8fe38b..0959a58 100644 --- a/src/utils/Events/button.ts +++ b/src/utils/Events/button.ts @@ -15,8 +15,7 @@ export default async function loadButtonEvents(client: Client, ft: FileType) { for (const file of btnFiles) { const filePath = path.join(btnPath, file) - const { default: btnImport } = await import("file://" + filePath) - const btn: IButton = btnImport + const { default: btn } = await import("file://" + filePath) as { default: IButton } if ("name" in btn && "execute" in btn) { client.buttons.set(btn.name, btn) diff --git a/src/utils/Events/command.ts b/src/utils/Events/command.ts index bd4599e..53b1b10 100644 --- a/src/utils/Events/command.ts +++ b/src/utils/Events/command.ts @@ -15,8 +15,7 @@ export default async function loadSlashCommandsEvents(client: Client, ft: FileTy for (const file of cmdFiles) { const filePath = path.join(cmdPath, file) - const { default: cmdImport } = await import("file://" + filePath) - const cmd: ICommand = cmdImport + const { default: cmd } = await import("file://" + filePath) as { default: ICommand } if ("data" in cmd && "execute" in cmd) { client.commands.set(cmd.data.name, cmd) diff --git a/src/utils/Events/contextmenu.ts b/src/utils/Events/contextmenu.ts index bc03fce..cb63aa8 100644 --- a/src/utils/Events/contextmenu.ts +++ b/src/utils/Events/contextmenu.ts @@ -15,8 +15,7 @@ export default async function loadContextMenuEvents(client: Client, ft: FileType for (const file of contextMenuFiles) { const filePath = path.join(contextMenuPath, file) - const { default: cmdImport } = await import("file://" + filePath) - const cmd: IContextMenu = cmdImport + const { default: cmd } = await import("file://" + filePath) as { default: IContextMenu } if ("data" in cmd && "execute" in cmd) { client.contextmenus.set(cmd.data.name, cmd) diff --git a/src/utils/Events/cron.ts b/src/utils/Events/cron.ts index 0fbe9d9..b7810b9 100644 --- a/src/utils/Events/cron.ts +++ b/src/utils/Events/cron.ts @@ -10,8 +10,7 @@ export default async function loadCronEvents() { for (const file of cronFiles) { const filePath = path.join(cronPath, file) - const { default: cronImport } = await import("file://" + filePath) - const cron: ICron = cronImport + const { default: cron } = await import("file://" + filePath) as { default: ICron } const time = cron.time.seconds + " " + diff --git a/src/utils/Events/events.ts b/src/utils/Events/events.ts index 34c7536..3642843 100644 --- a/src/utils/Events/events.ts +++ b/src/utils/Events/events.ts @@ -11,8 +11,7 @@ export default async function loadEvents(client: Client) { const eventFiles = fs.readdirSync(path.join(serverDir, eventDir)) for (const eventFile of eventFiles) { const eventPath = path.join(serverDir, eventDir, eventFile) - const { default: eventImport } = await import("file://" + eventPath) - const event: IEvent = eventImport + const { default: event } = await import("file://" + eventPath) as { default: IEvent } if (!event.disabled) { client.on(event.event, event.execute) } diff --git a/src/utils/Events/modal.ts b/src/utils/Events/modal.ts index 973b887..f6e4fe1 100644 --- a/src/utils/Events/modal.ts +++ b/src/utils/Events/modal.ts @@ -15,8 +15,7 @@ export default async function loadModalEvents(client: Client, ft: FileType) { for (const file of modalFiles) { const filePath = path.join(modalPath, file) - const { default: modalImport } = await import("file://" + filePath) - const modal: IModal = modalImport + const { default: modal } = await import("file://" + filePath) as { default: IModal } if ("name" in modal && "execute" in modal) { client.modals.set(modal.name, modal)