Skip to content

Commit

Permalink
refactor: update Event class handle method signature
Browse files Browse the repository at this point in the history
Updated the `handle` method signature in the `Event` class to return `void` or `Promise<void | InteractionResponse | Message>`. It ensures that the method can handle asynchronous operations and return the correct types for Discord interactions
  • Loading branch information
dankerow committed Aug 22, 2024
1 parent 3a607a9 commit 2d4dae6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/structures/Event.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { InteractionResponse, Message } from 'discord.js';

/**
* @class Event
* @description This class represents an event in the application based on Discord bot client events.
Expand Down Expand Up @@ -34,7 +36,7 @@ export class Event {
* @throws {Error} Throws an error if the method is not overridden in a subclass.
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
handle(...args: any[]) {
handle(...args: any[]): void | Promise<void | InteractionResponse | Message> {
throw new Error(`${this.name} doesn't have an handle() method.`)
}
}

0 comments on commit 2d4dae6

Please sign in to comment.