const allTextChannels = interaction.guild.channels.cache.filter(c => c.type === ChannelType.GuildText || c.type === ChannelType.GuildForum);
const channels = allTextChannels.filter(c => allowedChannelIds.includes(c.id));
const options = channels.map((c, i) =>
new StringSelectMenuOptionBuilder()
.setLabel(c.name)
.setValue(c.id)
.setDefault(i === 0) // first as default
);
const modal = new ModalBuilder()
.setCustomId(`create_modal`)
.setTitle('Create Private Thread')
.addLabelComponents(
new LabelBuilder()
.setLabel('In Channel')
.setStringSelectMenuComponent(
new StringSelectMenuBuilder()
.setCustomId('channelSelect')
.addOptions(options)
)
)
.addLabelComponents(
new LabelBuilder()
.setLabel('Thread message')
.setTextInputComponent(
new TextInputBuilder()
.setCustomId('createThreadMessage')
.setStyle(TextInputStyle.Paragraph)
)
);
await interaction.showModal(modal);
const allTextChannels = interaction.guild.channels.cache.filter(c => c.type === ChannelType.GuildText || c.type === ChannelType.GuildForum);
const channels = allTextChannels.filter(c => allowedChannelIds.includes(c.id));
const options = channels.map((c, i) =>
new StringSelectMenuOptionBuilder()
.setLabel(c.name)
.setValue(c.id)
.setDefault(i === 0) // first as default
);
const modal = new ModalBuilder()
.setCustomId(`create_modal`)
.setTitle('Create Private Thread')
.addLabelComponents(
new LabelBuilder()
.setLabel('In Channel')
.setStringSelectMenuComponent(
new StringSelectMenuBuilder()
.setCustomId('channelSelect')
.addOptions(options)
)
)
.addLabelComponents(
new LabelBuilder()
.setLabel('Thread message')
.setTextInputComponent(
new TextInputBuilder()
.setCustomId('createThreadMessage')
.setStyle(TextInputStyle.Paragraph)
)
);
await interaction.showModal(modal);