コンテンツにスキップ

Modal

import { Modal, TextInput } from 'discord-hono'
const modal = new Modal('unique-id', 'モーダルタイトル').row(
new TextInput('custom_id', 'テキストラベル'),
)

.row()

const modal = new Modal('unique-id', 'モーダルタイトル')
.row(new TextInput('text-1', 'テキストラベル'))
.row(new TextInput('text-2', '複数行入力', 'Multi'))

.row()Action Rows と同じ機能です。

TextInput

import { Modal, TextInput } from 'discord-hono'
type Style = 'Single' | 'Multi'
const modal = new Modal('unique-id', 'モーダルタイトル')
.row(new TextInput('text-1', 'テキストラベル'))
.row(new TextInput('custom_id', '複数行入力', 'Multi' as Style))

第3引数には TextInput のスタイルを指定します。デフォルトは Single です。

Method

const modal = new Modal('unique-id', 'モーダルタイトル').row(
new TextInput('custom_id', 'テキストラベル')
.min_length()
.max_length()
.required()
.value()
.placeholder(),
)

公式ドキュメントを参照してください。