Skip to content

Commit 5e6b0c2

Browse files
authored
feat(ButtonKit): add end reason to onEnd
1 parent 29b4a0e commit 5e6b0c2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/commandkit/src/components/ButtonKit.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export type CommandKitButtonBuilderInteractionCollectorDispatch = (
1818
interaction: ButtonInteraction,
1919
) => Awaitable<void>;
2020

21-
export type CommandKitButtonBuilderOnEnd = () => Awaitable<void>;
21+
export type CommandKitButtonBuilderOnEnd = (reason: string) => Awaitable<void>;
2222

2323
export type CommandKitButtonBuilderInteractionCollectorDispatchContextData = {
2424
/**
@@ -156,15 +156,15 @@ export class ButtonKit extends ButtonBuilder {
156156
return handler(interaction);
157157
});
158158

159-
this.#collector.on('end', () => {
159+
this.#collector.on('end', (_, reason) => {
160160
this.#destroyCollector();
161-
this.#onEndHandler?.();
161+
this.#onEndHandler?.(reason);
162162
});
163163
}
164164

165165
public dispose() {
166166
this.#destroyCollector();
167-
this.#onEndHandler?.();
167+
this.#onEndHandler?.('disposed');
168168
return this;
169169
}
170170

0 commit comments

Comments
 (0)