pnp-scheduler/source/Menu/Modals/Prompt.ts

17 lines
No EOL
521 B
TypeScript

import {Modal} from "./Modal";
import {Interaction, MessageComponentInteraction, TextInputBuilder} from "discord.js";
export class Prompt extends Modal {
public async requestValue(
label: string,
field: TextInputBuilder,
interaction: MessageComponentInteraction
): Promise<string> {
const modal = this.getBuilder()
.setTitle(label);
await interaction.showModal(modal);
const responseInteraction = await this.awaitResponse();
responseInteraction.fields.getTextInputValue()
}
}