Remove extra declaration

This commit is contained in:
2024-08-24 22:59:02 +02:00
parent 2a8e253f4f
commit 8b8c50551f
7 changed files with 7 additions and 14 deletions

View File

@@ -15,8 +15,7 @@ export default async function loadAutocompleteEvents(client: Client, ft: FileTyp
for (const file of autocompleteFiles) { for (const file of autocompleteFiles) {
const filePath = path.join(autocompletePath, file) const filePath = path.join(autocompletePath, file)
const { default: autocompleteImport } = await import("file://" + filePath) const { default: autocomplete } = await import("file://" + filePath) as { default: IAutocomplete }
const autocomplete: IAutocomplete = autocompleteImport
if ("name" in autocomplete && "execute" in autocomplete) { if ("name" in autocomplete && "execute" in autocomplete) {
client.autocomplete.set(autocomplete.name, autocomplete) client.autocomplete.set(autocomplete.name, autocomplete)

View File

@@ -15,8 +15,7 @@ export default async function loadButtonEvents(client: Client, ft: FileType) {
for (const file of btnFiles) { for (const file of btnFiles) {
const filePath = path.join(btnPath, file) const filePath = path.join(btnPath, file)
const { default: btnImport } = await import("file://" + filePath) const { default: btn } = await import("file://" + filePath) as { default: IButton }
const btn: IButton = btnImport
if ("name" in btn && "execute" in btn) { if ("name" in btn && "execute" in btn) {
client.buttons.set(btn.name, btn) client.buttons.set(btn.name, btn)

View File

@@ -15,8 +15,7 @@ export default async function loadSlashCommandsEvents(client: Client, ft: FileTy
for (const file of cmdFiles) { for (const file of cmdFiles) {
const filePath = path.join(cmdPath, file) const filePath = path.join(cmdPath, file)
const { default: cmdImport } = await import("file://" + filePath) const { default: cmd } = await import("file://" + filePath) as { default: ICommand }
const cmd: ICommand = cmdImport
if ("data" in cmd && "execute" in cmd) { if ("data" in cmd && "execute" in cmd) {
client.commands.set(cmd.data.name, cmd) client.commands.set(cmd.data.name, cmd)

View File

@@ -15,8 +15,7 @@ export default async function loadContextMenuEvents(client: Client, ft: FileType
for (const file of contextMenuFiles) { for (const file of contextMenuFiles) {
const filePath = path.join(contextMenuPath, file) const filePath = path.join(contextMenuPath, file)
const { default: cmdImport } = await import("file://" + filePath) const { default: cmd } = await import("file://" + filePath) as { default: IContextMenu }
const cmd: IContextMenu = cmdImport
if ("data" in cmd && "execute" in cmd) { if ("data" in cmd && "execute" in cmd) {
client.contextmenus.set(cmd.data.name, cmd) client.contextmenus.set(cmd.data.name, cmd)

View File

@@ -10,8 +10,7 @@ export default async function loadCronEvents() {
for (const file of cronFiles) { for (const file of cronFiles) {
const filePath = path.join(cronPath, file) const filePath = path.join(cronPath, file)
const { default: cronImport } = await import("file://" + filePath) const { default: cron } = await import("file://" + filePath) as { default: ICron }
const cron: ICron = cronImport
const time = const time =
cron.time.seconds + " " + cron.time.seconds + " " +

View File

@@ -11,8 +11,7 @@ export default async function loadEvents(client: Client) {
const eventFiles = fs.readdirSync(path.join(serverDir, eventDir)) const eventFiles = fs.readdirSync(path.join(serverDir, eventDir))
for (const eventFile of eventFiles) { for (const eventFile of eventFiles) {
const eventPath = path.join(serverDir, eventDir, eventFile) const eventPath = path.join(serverDir, eventDir, eventFile)
const { default: eventImport } = await import("file://" + eventPath) const { default: event } = await import("file://" + eventPath) as { default: IEvent }
const event: IEvent = eventImport
if (!event.disabled) { if (!event.disabled) {
client.on(event.event, event.execute) client.on(event.event, event.execute)
} }

View File

@@ -15,8 +15,7 @@ export default async function loadModalEvents(client: Client, ft: FileType) {
for (const file of modalFiles) { for (const file of modalFiles) {
const filePath = path.join(modalPath, file) const filePath = path.join(modalPath, file)
const { default: modalImport } = await import("file://" + filePath) const { default: modal } = await import("file://" + filePath) as { default: IModal }
const modal: IModal = modalImport
if ("name" in modal && "execute" in modal) { if ("name" in modal && "execute" in modal) {
client.modals.set(modal.name, modal) client.modals.set(modal.name, modal)