Skip to content

Commit 43cf1a3

Browse files
committed
Improve subscriptions, allow emojis
1 parent ade6847 commit 43cf1a3

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/componentHandler.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ export class ComponentHandler {
122122
options: componentOptions.options?.map((x) => ({
123123
...(x ?? undefined),
124124
description: x.description ?? undefined,
125-
emoji: undefined,
126125
})),
127126
placeholder: componentOptions.placeholder ?? undefined,
128127
customId: customIdBase,

src/types.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,27 @@ interface BaseActionParameters extends BarebonesActionParameters {
9696
/**Sends a DM to the author of the message, resolves to undefined if an error occurs */
9797
dm: (msg: SendableMessage) => Promise<Message | undefined>;
9898

99+
/**Creates a new message component which can then be attached to a response (eg. via `createEmbed({components: []})`)
100+
* Any content returned will be used to edit the newly created message via msg.edit or msg.editReply
101+
* It supports both buttons and select menus
102+
* Note that these subscriptions get reset when the bot resets, and have a default timeout of 60 seconds
103+
* You can also limit who has access to the component, by default only the command invoker can trigger.
104+
* Pass an array of user IDs to the last parameter to change this
105+
*/
99106
subscribe(
100107
componentOptions: NonNullable<
101108
| NonNullableObject<NonNullable<Omit<MessageButtonOptions, "customId">>>[]
102109
| Partial<MessageButtonOptions>
103110
| Partial<MessageSelectMenuOptions>
104111
>,
112+
/**
113+
* `params.msg` contains the newly created message this component will be attached to
114+
*/
105115
action: (
106116
params: ActionParameters,
107117
interaction: MessageComponentInteraction,
108118
value: number | string
109-
) => SendableMessage | undefined,
119+
) => SendableMessage | Promise<void> | void,
110120
idle?: number,
111121
expectFromUserIds?: string[]
112122
): MessageActionRow;

0 commit comments

Comments
 (0)