Skip to content

Commit c3a7c2d

Browse files
committed
docs: update MediaGallery component example
1 parent 243244c commit c3a7c2d

File tree

2 files changed

+16
-26
lines changed

2 files changed

+16
-26
lines changed

apps/test-bot/src/app/commands/(interactions)/commandkit.tsx

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import {
1515
TextDisplay,
1616
Container,
1717
Separator,
18+
MediaGallery,
19+
MediaGalleryItem,
1820
} from 'commandkit';
1921
import {
2022
ButtonStyle,
@@ -57,34 +59,23 @@ export const command: CommandData = {
5759
// }
5860

5961
export const chatInput: ChatInputCommand = async ({ interaction }) => {
60-
const headerContainer = (
61-
<Container accentColor={Colors.Blue}>
62-
<TextDisplay content="# Bot Status Report" />
63-
<TextDisplay
64-
content={`Generated on <t:${Math.floor(Date.now() / 1000)}:F>`}
65-
/>
66-
</Container>
67-
);
62+
const images = [
63+
'https://cdn.discordapp.com/embed/avatars/0.png',
64+
'https://cdn.discordapp.com/embed/avatars/1.png',
65+
'https://cdn.discordapp.com/embed/avatars/2.png',
66+
];
6867

69-
const statsContainer = (
70-
<Container accentColor={Colors.Green}>
71-
<TextDisplay content="## Server Statistics" />
72-
<TextDisplay content="**Servers:** 50" />
73-
<TextDisplay content="**Users:** 15,000" />
74-
<TextDisplay content="**Commands executed:** 1,250 today" />
75-
</Container>
76-
);
77-
78-
const alertsContainer = (
79-
<Container accentColor={Colors.Yellow}>
80-
<TextDisplay content="## System Alerts" />
81-
<TextDisplay content="⚠️ Scheduled maintenance in 2 hours" />
82-
<TextDisplay content="✅ All systems operational" />
83-
</Container>
84-
);
68+
const components = [
69+
<TextDisplay content="# Discord Avatars Gallery" />,
70+
<MediaGallery>
71+
{images.map((url, index) => (
72+
<MediaGalleryItem url={url} description={`Avatar ${index + 1}`} />
73+
))}
74+
</MediaGallery>,
75+
];
8576

8677
await interaction.reply({
87-
components: [headerContainer, statsContainer, alertsContainer],
78+
components: components,
8879
flags: MessageFlags.IsComponentsV2,
8980
});
9081
};

apps/website/docs/guide/04-jsx-components/03-discord-components-v2/03-media-gallery.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export const chatInput: ChatInputCommand = async ({
3030
<MediaGallery>
3131
{images.map((url, index) => (
3232
<MediaGalleryItem
33-
key={index}
3433
url={url}
3534
description={`Avatar ${index + 1}`}
3635
/>

0 commit comments

Comments
 (0)