Skip to main content

Documentation Index

Fetch the complete documentation index at: https://djs-core.cleboost.com/llms.txt

Use this file to discover all available pages before exploring further.

Channel select menus allow users to select one or more Discord channels from the server. They’re useful for channel configuration, announcements, or channel-based features.
Channel select menus dynamically show all channels the user can see. You can filter which channel types users can select using setChannelTypes().

Creating a Channel Select Menu

Channel select menus in djs-core are created using the ChannelSelectMenu class. Each select menu component file in src/components/selects/channel/ is automatically registered.

Basic Channel Select Menu

import { ChannelSelectMenu } from "@djs-core/runtime";

export default new ChannelSelectMenu()
        .setPlaceholder("Select a channel")
        .run(async (interaction) => {
                const selectedChannel = interaction.channels.first();
                if (selectedChannel) {
                        await interaction.reply(`You selected: ${selectedChannel.name}`);
                }
        });

Channel Types

You can filter which channel types users can select:
import { ChannelSelectMenu } from "@djs-core/runtime";
import { ChannelType } from "discord.js";

export default new ChannelSelectMenu()
        .setPlaceholder("Select a text channel")
        .setChannelTypes([ChannelType.GuildText])
        .run(async (interaction) => {
                const channel = interaction.channels.first();
                if (channel) {
                        await interaction.reply(`Selected text channel: ${channel.name}`);
                }
        });

Channel Select Menu Data

Channel select menus can receive custom data using .setData().

Component Definition

[src/components/selects/channel/config.ts]
import { ChannelSelectMenu } from "@djs-core/runtime";

export default new ChannelSelectMenu<{ category: string }>()
        .setPlaceholder("Select channels")
        .run(async (interaction, data) => {
                const channels = interaction.channels.map((ch) => ch.name);
                await interaction.reply(
                        `Configured ${data.category} channels: ${channels.join(", ")}`,
                );
        });

Using Select Menu with Data

configChannelSelect.setData({ category: "announcements" })