diff --git a/src/utils/Events/autocomplete.ts b/src/utils/Events/autocomplete.ts index 324bcd4..68aefde 100644 --- a/src/utils/Events/autocomplete.ts +++ b/src/utils/Events/autocomplete.ts @@ -4,7 +4,6 @@ import fs from "fs" import { IAutocomplete } from "interfaces" import path from "path" import { ExtendedClient as Client } from "utils/Client.js" -import { color } from "utils/functions/colors.js" import logToChannel from "utils/functions/logtochannel.js" type FileType = "js" | "ts" const __dirname = import.meta.dirname @@ -16,17 +15,7 @@ export default async function loadAutocompleteEvents(client: Client, ft: FileTyp for (const file of autocompleteFiles) { const filePath = path.join(autocompletePath, file) const { default: autocomplete } = await import("file://" + filePath) as { default: IAutocomplete } - - if ("name" in autocomplete && "execute" in autocomplete) { - client.autocomplete.set(autocomplete.name, autocomplete) - } else { - console.log( - color( - `[WARNING] The autocomplete at ${filePath} is missing a required "name", "execute" or "type" property.`, - "red" - ) - ) - } + client.autocomplete.set(autocomplete.name, autocomplete) } client.on(Events.InteractionCreate, async interaction => { diff --git a/src/utils/Events/button.ts b/src/utils/Events/button.ts index d41671a..5f98279 100644 --- a/src/utils/Events/button.ts +++ b/src/utils/Events/button.ts @@ -4,7 +4,6 @@ import fs from "fs" import { IButton } from "interfaces" import path from "path" import { ExtendedClient as Client } from "utils/Client.js" -import { color } from "utils/functions/colors.js" import logToChannel from "utils/functions/logtochannel.js" type FileType = "js" | "ts" const __dirname = import.meta.dirname @@ -16,17 +15,7 @@ export default async function loadButtonEvents(client: Client, ft: FileType) { for (const file of btnFiles) { const filePath = path.join(btnPath, file) const { default: btn } = await import("file://" + filePath) as { default: IButton } - - if ("name" in btn && "execute" in btn) { - client.buttons.set(btn.name, btn) - } else { - console.log( - color( - `[WARNING] The button at ${filePath} is missing a required "name", "execute" or "type" property.`, - "red" - ) - ) - } + client.buttons.set(btn.name, btn) } client.on(Events.InteractionCreate, async interaction => { @@ -38,6 +27,10 @@ export default async function loadButtonEvents(client: Client, ft: FileType) { const button = client.buttons.get(customId) if (!button) { + interaction.reply({ + content: "Button logic not implemented. This is most likely an old button", + ephemeral: true + }) console.error(`No event matching ${interaction.customId} was found.`) return } diff --git a/src/utils/Events/command.ts b/src/utils/Events/command.ts index f56d4aa..480f26a 100644 --- a/src/utils/Events/command.ts +++ b/src/utils/Events/command.ts @@ -4,7 +4,6 @@ import fs from "fs" import { ICommand } from "interfaces" import path from "path" import { ExtendedClient as Client } from "utils/Client.js" -import { color } from "utils/functions/colors.js" import logToChannel from "utils/functions/logtochannel.js" type FileType = "js" | "ts" const __dirname = import.meta.dirname @@ -16,17 +15,7 @@ export default async function loadSlashCommandsEvents(client: Client, ft: FileTy for (const file of cmdFiles) { const filePath = path.join(cmdPath, file) const { default: cmd } = await import("file://" + filePath) as { default: ICommand } - - if ("data" in cmd && "execute" in cmd) { - client.commands.set(cmd.data.name, cmd) - } else { - console.log( - color( - `[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`, - "red" - ) - ) - } + client.commands.set(cmd.data.name, cmd) } // ! command handler @@ -36,9 +25,11 @@ export default async function loadSlashCommandsEvents(client: Client, ft: FileTy const command = client.commands.get(interaction.commandName) if (!command) { - console.error( - `No command matching ${interaction.commandName} was found.` - ) + interaction.reply({ + content: "Command logic not implemented. This is most likely an old command", + ephemeral: true + }) + console.error(`No command matching ${interaction.commandName} was found.`) return } diff --git a/src/utils/Events/contextmenu.ts b/src/utils/Events/contextmenu.ts index 4f0e2a3..b81dc6f 100644 --- a/src/utils/Events/contextmenu.ts +++ b/src/utils/Events/contextmenu.ts @@ -4,7 +4,6 @@ import fs from "fs" import { IContextMenu } from "interfaces" import path from "path" import { ExtendedClient as Client } from "utils/Client.js" -import { color } from "utils/functions/colors.js" import logToChannel from "utils/functions/logtochannel.js" type FileType = "js" | "ts" const __dirname = import.meta.dirname @@ -16,17 +15,7 @@ export default async function loadContextMenuEvents(client: Client, ft: FileType for (const file of contextMenuFiles) { const filePath = path.join(contextMenuPath, file) const { default: cmd } = await import("file://" + filePath) as { default: IContextMenu } - - if ("data" in cmd && "execute" in cmd) { - client.contextmenus.set(cmd.data.name, cmd) - } else { - console.log( - color( - `[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`, - "red" - ) - ) - } + client.contextmenus.set(cmd.data.name, cmd) } // ! context menu command handler @@ -36,6 +25,10 @@ export default async function loadContextMenuEvents(client: Client, ft: FileType const command = client.contextmenus.get(interaction.commandName) if (!command) { + interaction.reply({ + content: "Command logic not implemented. This is most likely an old command", + ephemeral: true + }) console.error(`No command matching ${interaction.commandName} was found.`) return } diff --git a/src/utils/Events/cron.ts b/src/utils/Events/cron.ts index 73dfd40..f1c264e 100644 --- a/src/utils/Events/cron.ts +++ b/src/utils/Events/cron.ts @@ -2,11 +2,12 @@ import { CronJob } from "cron" import fs from "fs" import { ICron } from "interfaces" import path from "path" +type FileType = "js" | "ts" const __dirname = import.meta.dirname -export default async function loadCronEvents() { +export default async function loadCronEvents(ft: FileType) { const cronPath = path.join(__dirname, "..", "..", "events", "cron") - const cronFiles = fs.readdirSync(cronPath).filter(file => file.endsWith(".js")) + const cronFiles = fs.readdirSync(cronPath).filter(file => file.endsWith(ft)) for (const file of cronFiles) { const filePath = path.join(cronPath, file) diff --git a/src/utils/Events/loadevents.ts b/src/utils/Events/loadevents.ts index 79c5f2d..eee3d73 100644 --- a/src/utils/Events/loadevents.ts +++ b/src/utils/Events/loadevents.ts @@ -14,5 +14,5 @@ export default async function loadAllEvents(client: Client, ft: "js" | "ts") { await loadContextMenuEvents(client, ft) await loadModalEvents(client, ft) await loadAutocompleteEvents(client, ft) - await loadCronEvents() + await loadCronEvents(ft) } diff --git a/src/utils/Events/modal.ts b/src/utils/Events/modal.ts index 9f7b126..c26f3b9 100644 --- a/src/utils/Events/modal.ts +++ b/src/utils/Events/modal.ts @@ -4,7 +4,6 @@ import fs from "fs" import { IModal } from "interfaces" import path from "path" import { ExtendedClient as Client } from "utils/Client.js" -import { color } from "utils/functions/colors.js" import logToChannel from "utils/functions/logtochannel.js" type FileType = "js" | "ts" const __dirname = import.meta.dirname @@ -16,17 +15,7 @@ export default async function loadModalEvents(client: Client, ft: FileType) { for (const file of modalFiles) { const filePath = path.join(modalPath, file) const { default: modal } = await import("file://" + filePath) as { default: IModal } - - if ("name" in modal && "execute" in modal) { - client.modals.set(modal.name, modal) - } else { - console.log( - color( - `[WARNING] The modal at ${filePath} is missing a required "name", "execute" or "type" property.`, - "red" - ) - ) - } + client.modals.set(modal.name, modal) } client.on(Events.InteractionCreate, async interaction => { @@ -35,6 +24,10 @@ export default async function loadModalEvents(client: Client, ft: FileType) { const modal = client.modals.get(interaction.customId) if (!modal) { + interaction.reply({ + content: "Modal logic not implemented. This is most likely an old modal", + ephemeral: true + }) console.error(`No modal matching ${interaction.customId} was found.`) return }