refactor: consolidate modal routing and use LabelBuilder for modal components
Node.js CI / CI (push) Successful in 41s
Security Scan and Upload / Security & DefectDojo Upload (push) Successful in 1m56s

Merges modalInteractionCreate into interactionCreate, and replaces
ActionRowBuilder with LabelBuilder for the announcement modal components.
This commit is contained in:
2026-03-12 23:21:06 -07:00
committed by Naomi Carrigan
parent e2167b117a
commit 11b23b10a6
4 changed files with 36 additions and 38 deletions
+13 -10
View File
@@ -5,7 +5,7 @@
*/
import {
ActionRowBuilder,
LabelBuilder,
ModalBuilder,
StringSelectMenuBuilder,
TextInputBuilder,
@@ -37,8 +37,6 @@ export const announcement: Command = async(_hikari, interaction) => {
const contentInput = new TextInputBuilder().
setCustomId("content").
// eslint-disable-next-line deprecation/deprecation -- No V2 equivalent exists for modal text input labels
setLabel("Announcement Copy").
setStyle(TextInputStyle.Paragraph).
setMaxLength(4000).
setRequired(true);
@@ -52,13 +50,18 @@ export const announcement: Command = async(_hikari, interaction) => {
{ label: "Company", value: "company" },
]);
// eslint-disable-next-line deprecation/deprecation -- No V2 equivalent exists for modal component rows
modal.addComponents(
new ActionRowBuilder<TextInputBuilder>().addComponents(contentInput),
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- discord.js types don't yet reflect select menus in modals, but they're supported at the API level
new ActionRowBuilder<StringSelectMenuBuilder>().addComponents(
categorySelect,
) as unknown as ActionRowBuilder<TextInputBuilder>,
const contentLabel = new LabelBuilder().setLabel("Announcement Copy").
setDescription(
"Your version of the announcement, to send to the AI for processing.",
).
setTextInputComponent(contentInput);
const categoryLabel = new LabelBuilder().setLabel("Announcement Category").
setDescription("The category of the announcement.").
setStringSelectMenuComponent(categorySelect);
modal.addLabelComponents(
contentLabel,
categoryLabel,
);
await interaction.showModal(modal);