forked from mdshamoon/github-issues-bot
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathutils.ts
37 lines (31 loc) · 956 Bytes
/
utils.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import {
ActionRowBuilder,
ModalBuilder,
TextInputBuilder,
TextInputStyle,
} from "discord.js";
export const getModal = (title?: string, description?: string) => {
const modal = new ModalBuilder()
.setTitle("Create github issue")
.setCustomId("AwesomeForm");
const issueTitle = new TextInputBuilder()
.setStyle(TextInputStyle.Short)
.setCustomId("issueTitle")
.setLabel("Issue title")
.setValue(title || "")
.setRequired(true)
.setMinLength(12);
const issueDescription = new TextInputBuilder()
.setStyle(TextInputStyle.Paragraph)
.setCustomId("issueDescription")
.setLabel("Issue description")
.setValue(description || "")
.setRequired(true)
.setMinLength(12);
const rows = [issueTitle, issueDescription].map((component) =>
new ActionRowBuilder<TextInputBuilder>().addComponents([component])
);
// Add action rows to form
modal.addComponents(rows);
return modal;
};