@@ -11,11 +11,9 @@ The most common type of select menu that allows users to select from
1111predefined string options:
1212
1313``` tsx title="src/app/commands/string-select.tsx"
14- import type {
15- ChatInputCommand ,
16- OnStringSelectMenuKitSubmit ,
17- } from ' commandkit' ;
1814import {
15+ type ChatInputCommand ,
16+ type OnStringSelectMenuKitSubmit ,
1917 ActionRow ,
2018 StringSelectMenu ,
2119 StringSelectMenuOption ,
@@ -31,6 +29,8 @@ const handleSelect: OnStringSelectMenuKitSubmit = async (
3129 content: ` You selected: ${selection } ` ,
3230 flags: MessageFlags .Ephemeral ,
3331 });
32+
33+ // Clean up the select menu context
3434 context .dispose ();
3535};
3636
@@ -77,11 +77,12 @@ export const chatInput: ChatInputCommand = async ({
7777Allows users to select a channel from the server:
7878
7979``` tsx title="src/app/commands/channel-select.tsx"
80- import type {
81- ChatInputCommand ,
82- OnChannelSelectMenuKitSubmit ,
80+ import {
81+ type ChatInputCommand ,
82+ type OnChannelSelectMenuKitSubmit ,
83+ ActionRow ,
84+ ChannelSelectMenu ,
8385} from ' commandkit' ;
84- import { ActionRow , ChannelSelectMenu } from ' commandkit' ;
8586import { MessageFlags } from ' discord.js' ;
8687
8788const handleSelect: OnChannelSelectMenuKitSubmit = async (
@@ -93,6 +94,8 @@ const handleSelect: OnChannelSelectMenuKitSubmit = async (
9394 content: ` Selected channel: <#${channel }> ` ,
9495 flags: MessageFlags .Ephemeral ,
9596 });
97+
98+ // Clean up the select menu context
9699 context .dispose ();
97100};
98101
@@ -120,11 +123,12 @@ export const chatInput: ChatInputCommand = async ({
120123Allows users to select a role from the server:
121124
122125``` tsx title="src/app/commands/role-select.tsx"
123- import type {
124- ChatInputCommand ,
125- OnRoleSelectMenuKitSubmit ,
126+ import {
127+ type ChatInputCommand ,
128+ type OnRoleSelectMenuKitSubmit ,
129+ ActionRow ,
130+ RoleSelectMenu ,
126131} from ' commandkit' ;
127- import { ActionRow , RoleSelectMenu } from ' commandkit' ;
128132import { MessageFlags } from ' discord.js' ;
129133
130134const handleSelect: OnRoleSelectMenuKitSubmit = async (
@@ -136,6 +140,8 @@ const handleSelect: OnRoleSelectMenuKitSubmit = async (
136140 content: ` Selected role: <@&${role }> ` ,
137141 flags: MessageFlags .Ephemeral ,
138142 });
143+
144+ // Clean up the select menu context
139145 context .dispose ();
140146};
141147
@@ -163,11 +169,12 @@ export const chatInput: ChatInputCommand = async ({
163169Allows users to select a user from the server:
164170
165171``` tsx title="src/app/commands/user-select.tsx"
166- import type {
167- ChatInputCommand ,
168- OnUserSelectMenuKitSubmit ,
172+ import {
173+ type ChatInputCommand ,
174+ type OnUserSelectMenuKitSubmit ,
175+ ActionRow ,
176+ UserSelectMenu ,
169177} from ' commandkit' ;
170- import { ActionRow , UserSelectMenu } from ' commandkit' ;
171178import { MessageFlags } from ' discord.js' ;
172179
173180const handleSelect: OnUserSelectMenuKitSubmit = async (
@@ -179,6 +186,8 @@ const handleSelect: OnUserSelectMenuKitSubmit = async (
179186 content: ` Selected user: <@${user }> ` ,
180187 flags: MessageFlags .Ephemeral ,
181188 });
189+
190+ // Clean up the select menu context
182191 context .dispose ();
183192};
184193
@@ -206,11 +215,12 @@ export const chatInput: ChatInputCommand = async ({
206215Allows users to select a user or role from the server:
207216
208217``` tsx title="src/app/commands/mentionable-select.tsx"
209- import type {
210- ChatInputCommand ,
211- OnMentionableSelectMenuKitSubmit ,
218+ import {
219+ type ChatInputCommand ,
220+ type OnMentionableSelectMenuKitSubmit ,
221+ ActionRow ,
222+ MentionableSelectMenu ,
212223} from ' commandkit' ;
213- import { ActionRow , MentionableSelectMenu } from ' commandkit' ;
214224import { MessageFlags } from ' discord.js' ;
215225
216226const handleSelect: OnMentionableSelectMenuKitSubmit = async (
@@ -222,6 +232,8 @@ const handleSelect: OnMentionableSelectMenuKitSubmit = async (
222232 content: ` Selected: <@${mentionable }> ` ,
223233 flags: MessageFlags .Ephemeral ,
224234 });
235+
236+ // Clean up the select menu context
225237 context .dispose ();
226238};
227239
@@ -250,11 +262,9 @@ You can allow multiple selections by setting the `minValues` and
250262` maxValues ` properties:
251263
252264``` tsx title="src/app/commands/multi-select.tsx"
253- import type {
254- ChatInputCommand ,
255- OnStringSelectMenuKitSubmit ,
256- } from ' commandkit' ;
257265import {
266+ type ChatInputCommand ,
267+ type OnStringSelectMenuKitSubmit ,
258268 ActionRow ,
259269 StringSelectMenu ,
260270 StringSelectMenuOption ,
@@ -270,6 +280,8 @@ const handleSelect: OnStringSelectMenuKitSubmit = async (
270280 content: ` You selected: ${selections .join (' , ' )} ` ,
271281 flags: MessageFlags .Ephemeral ,
272282 });
283+
284+ // Clean up the select menu context
273285 context .dispose ();
274286};
275287
0 commit comments