From 5e6b0c26ae1d99a611b97121c897812b56990564 Mon Sep 17 00:00:00 2001 From: Twilight <46562212+twlite@users.noreply.github.com> Date: Mon, 16 Dec 2024 11:58:00 +0545 Subject: [PATCH] feat(ButtonKit): add end reason to onEnd --- packages/commandkit/src/components/ButtonKit.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/commandkit/src/components/ButtonKit.ts b/packages/commandkit/src/components/ButtonKit.ts index 2bd21b9..aef2618 100644 --- a/packages/commandkit/src/components/ButtonKit.ts +++ b/packages/commandkit/src/components/ButtonKit.ts @@ -18,7 +18,7 @@ export type CommandKitButtonBuilderInteractionCollectorDispatch = ( interaction: ButtonInteraction, ) => Awaitable; -export type CommandKitButtonBuilderOnEnd = () => Awaitable; +export type CommandKitButtonBuilderOnEnd = (reason: string) => Awaitable; export type CommandKitButtonBuilderInteractionCollectorDispatchContextData = { /** @@ -156,15 +156,15 @@ export class ButtonKit extends ButtonBuilder { return handler(interaction); }); - this.#collector.on('end', () => { + this.#collector.on('end', (_, reason) => { this.#destroyCollector(); - this.#onEndHandler?.(); + this.#onEndHandler?.(reason); }); } public dispose() { this.#destroyCollector(); - this.#onEndHandler?.(); + this.#onEndHandler?.('disposed'); return this; }