diff --git a/src/commands/CommandHandler.ts b/src/commands/CommandHandler.ts index fcb0bdc..ea55f3b 100644 --- a/src/commands/CommandHandler.ts +++ b/src/commands/CommandHandler.ts @@ -23,7 +23,7 @@ export class CommandHandler extends SlashCommandBuilder { * @param id The new ID to use */ public setId(id: Snowflake): this { - Reflect.set(this, 'id', id); + Object.assign(this, { id }); return this; } diff --git a/src/events/EventHandler.ts b/src/events/EventHandler.ts index 5654705..73cab1d 100644 --- a/src/events/EventHandler.ts +++ b/src/events/EventHandler.ts @@ -25,27 +25,13 @@ export class EventHandler { this.name = name; } - /** - * Unnecessary because the name is set in the constructor and defines the generic class type. - * Unsafe because the generic type should never change, so the name should never change. - */ - // /** - // * Sets the name of the event this handler is for. - // * - // * @param name The name to use - // */ - // public setName (name: K): this { - // Reflect.set(this, 'name', name); - // return this; - // } - /** * Sets whether this event can only fire once. * * @param once Whether this event can only fire once */ public setOnce(once: boolean): this { - Reflect.set(this, 'once', once); + Object.assign(this, { once }); return this; } diff --git a/src/events/index.ts b/src/events/index.ts index 05ac9b9..c3cdfec 100644 --- a/src/events/index.ts +++ b/src/events/index.ts @@ -9,10 +9,10 @@ import { ready } from './ready.js'; /** The list of all event handlers. */ const eventHandlers = new Map(); -addEventHandler(error as EventHandler); -addEventHandler(interactionCreate as EventHandler); -addEventHandler(messageCreate as EventHandler); -addEventHandler(ready as EventHandler); +addEventHandler(error); +addEventHandler(interactionCreate); +addEventHandler(messageCreate); +addEventHandler(ready); /** * Add the given event handler to the list of event handlers.