Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions open-ticket/ot-ticket-forms/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ The `questions` array defines the form's questions. Each question object include
> For questions of type `short` or `long`:
> - **`optional`**: A boolean indicating if the question is optional (`true`) or required (`false`).
> - **`placeholder`**: A text placeholder for the response input (optional).
> - **`maxLength`**: A number to set the max length size of the response (optional, default 1023).

> #### Dropdown-Specific Properties
> For questions of type `dropdown`:
Expand Down Expand Up @@ -86,7 +87,8 @@ The `questions` array defines the form's questions. Each question object include
"question": "That's an example of paragraph answer question?",
"type": "long",
"optional": false,
"placeholder": "Multiple lines response, paragraphs allowed. (or leave it empty)"
"placeholder": "Multiple lines response, paragraphs allowed. (or leave it empty)",
"maxLength": 500
},
{
"number": 4,
Expand Down Expand Up @@ -122,4 +124,4 @@ The `questions` array defines the form's questions. Each question object include
7. The forms will be sent automatically when a user creates a ticket from which the option id is on the `autoSendOptionIds` field.
8. You can also send a form using the slash command `/form send <form> <channel>`.

By following this structure, you can create robust and flexible forms with the OT plugin.
By following this structure, you can create robust and flexible forms with the OT plugin.
3 changes: 2 additions & 1 deletion open-ticket/ot-ticket-forms/builders/modalBuilders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ opendiscord.events.get("onModalBuilderLoad").listen((modals) => {
style:question.type,
required:!question.optional,
placeholder:question.placeholder ? question.placeholder : undefined,
maxLength: question.maxLength ?? 1023,
});
}
})
)
});
});
8 changes: 5 additions & 3 deletions open-ticket/ot-ticket-forms/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"question":"This is an example of a short answer question. You can add as many questions as you want.",
"type":"short",
"optional":false,
"placeholder":"Single line response, no paragraphs allowed. (or leave it empty)"
"placeholder":"Single line response, no paragraphs allowed. (or leave it empty)",
"maxLength": 50
},
{
"position":2,
Expand Down Expand Up @@ -84,8 +85,9 @@
"question":"Question Nr1",
"type":"paragraph",
"optional":false,
"placeholder":"the placeholder (or leave it empty)"
"placeholder":"the placeholder (or leave it empty)",
"maxLength": 250
}
]
}
]
]
3 changes: 2 additions & 1 deletion open-ticket/ot-ticket-forms/types/configDefaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export interface OTForms_ModalQuestion extends OTForms_Question {
type: "short" | "paragraph",
placeholder: string,
optional: boolean,
maxLength: number,
}

/** ## OTForms_Choice `interface`
Expand Down Expand Up @@ -80,4 +81,4 @@ export interface OTForms_DropdownChoice extends OTForms_Choice {
*/
export class ODJsonConfig_DefaultForms extends api.ODJsonConfig {
declare data: OTForms_Form[]
}
}