-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.ts
32 lines (26 loc) · 880 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
import {
ActionRowBuilder,
ModalBuilder,
TextInputBuilder,
TextInputStyle,
} from "discord.js";
export const getModal = (description: string) => {
const modal = new ModalBuilder()
.setTitle("Create github issue")
.setCustomId("AwesomeForm");
const issueTitle = new TextInputBuilder()
.setStyle(TextInputStyle.Short)
.setCustomId("issueTitle")
.setLabel("Issue title");
const issueDescription = new TextInputBuilder()
.setStyle(TextInputStyle.Paragraph)
.setCustomId("issueDescription")
.setLabel("Issue description")
.setValue(description);
const rows = [issueTitle, issueDescription].map((component) =>
new ActionRowBuilder<TextInputBuilder>().addComponents([component])
);
// Add action rows to form
modal.addComponents(rows);
return modal;
};