Skip to content

Commit 79a92b8

Browse files
committed
feat: action row example
1 parent 54614c0 commit 79a92b8

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

apps/test-bot/src/app/commands/(general)/components.tsx

+19
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import CommandKit, {
2+
ActionRow,
23
Button,
4+
ChannelSelectMenu,
35
ChatInputCommand,
46
CommandData,
57
Container,
68
File,
79
MediaGallery,
810
MediaGalleryItem,
11+
OnChannelSelectMenuKitSubmit,
912
Section,
1013
Separator,
1114
TextDisplay,
@@ -31,6 +34,19 @@ const mediaItems: string[] = Array.from(
3134
(_, i) => `https://cdn.discordapp.com/embed/avatars/${i}.png`,
3235
);
3336

37+
const handleSelect: OnChannelSelectMenuKitSubmit = async (
38+
interaction,
39+
context,
40+
) => {
41+
const selections = interaction.channels.map((v) => v.toString()).join(', ');
42+
43+
await interaction.reply({
44+
content: `You selected: ${selections}`,
45+
});
46+
47+
context.dispose();
48+
};
49+
3450
export const chatInput: ChatInputCommand = async (ctx) => {
3551
const container = (
3652
<Container accentColor={Colors.Fuchsia}>
@@ -51,6 +67,9 @@ export const chatInput: ChatInputCommand = async (ctx) => {
5167
<MediaGalleryItem description="Gallery item description" url={item} />
5268
))}
5369
</MediaGallery>
70+
<ActionRow>
71+
<ChannelSelectMenu onSelect={handleSelect} />
72+
</ActionRow>
5473
</Container>
5574
);
5675

0 commit comments

Comments
 (0)