Skip to content

Commit 6cc7b9e

Browse files
committed
Properly document form commands
1 parent 71aa7fc commit 6cc7b9e

13 files changed

+82
-13
lines changed

src/main/java/net/discordjug/javabot/systems/staff_commands/forms/commands/AddFieldFormSubcommand.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.util.Arrays;
44
import java.util.Optional;
5+
56
import net.discordjug.javabot.systems.staff_commands.forms.dao.FormsRepository;
67
import net.discordjug.javabot.systems.staff_commands.forms.model.FormData;
78
import net.discordjug.javabot.systems.staff_commands.forms.model.FormField;
@@ -17,7 +18,14 @@
1718
import xyz.dynxsty.dih4jda.interactions.commands.application.SlashCommand.Subcommand;
1819

1920
/**
20-
* The `/form add-field` command.
21+
* The `/form add-field` command. This command allows for modification of
22+
* {@link FormData} by adding new fields to it. See
23+
* {@link RemoveFieldFormSubcommand} for the command used to remove fields from
24+
* a form.<br>
25+
* Currently, due to Discord limitations, only 5 fields are allowed per form.
26+
* Trying to add more fields will have no effect.
27+
*
28+
* @see FormData
2129
*/
2230
public class AddFieldFormSubcommand extends Subcommand implements AutoCompletable {
2331

src/main/java/net/discordjug/javabot/systems/staff_commands/forms/commands/AttachFormSubcommand.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import java.util.List;
66
import java.util.Optional;
77
import java.util.Set;
8+
89
import net.discordjug.javabot.systems.staff_commands.forms.FormInteractionManager;
910
import net.discordjug.javabot.systems.staff_commands.forms.dao.FormsRepository;
1011
import net.discordjug.javabot.systems.staff_commands.forms.model.FormData;
@@ -29,7 +30,14 @@
2930
import xyz.dynxsty.dih4jda.util.ComponentIdBuilder;
3031

3132
/**
32-
* The `/form attach` command.
33+
* The `/form attach` command. This command can be used to attach a form to an
34+
* existing message. "Attaching" a form to message in this case mean that the
35+
* bot will modify the target message with a button, that when interacted with,
36+
* will bring up a modal where the user can input their data. See
37+
* {@link DetachFormSubcommand} for a command used to detach the form from a
38+
* message.
39+
*
40+
* @see FormData
3341
*/
3442
public class AttachFormSubcommand extends Subcommand implements AutoCompletable {
3543

src/main/java/net/discordjug/javabot/systems/staff_commands/forms/commands/CloseFormSubcommand.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package net.discordjug.javabot.systems.staff_commands.forms.commands;
22

33
import java.util.Optional;
4+
45
import net.discordjug.javabot.data.config.BotConfig;
56
import net.discordjug.javabot.systems.staff_commands.forms.FormInteractionManager;
67
import net.discordjug.javabot.systems.staff_commands.forms.dao.FormsRepository;
@@ -17,7 +18,11 @@
1718
import xyz.dynxsty.dih4jda.interactions.commands.application.SlashCommand.Subcommand;
1819

1920
/**
20-
* The `/form close` command.
21+
* The `/form close` command. This command closes a form. A closed form doesn't
22+
* accept any new submissions. See {@link ReopenFormSubcommand} for a command
23+
* that can be used to re-open a closed form.
24+
*
25+
* @see FormData
2126
*/
2227
public class CloseFormSubcommand extends Subcommand implements AutoCompletable {
2328

src/main/java/net/discordjug/javabot/systems/staff_commands/forms/commands/CreateFormSubcommand.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.time.Instant;
44
import java.util.List;
55
import java.util.Optional;
6+
67
import net.discordjug.javabot.systems.staff_commands.forms.FormInteractionManager;
78
import net.discordjug.javabot.systems.staff_commands.forms.dao.FormsRepository;
89
import net.discordjug.javabot.systems.staff_commands.forms.model.FormData;
@@ -15,6 +16,11 @@
1516

1617
/**
1718
* The `/form create` command.
19+
* This command creates a new, empty form.
20+
* Newly created forms have no fields, and thus can't be attached (See {@link AttachFormSubcommand}) to messages.
21+
* Use {@link AddFieldFormSubcommand} to add new fields to the form.
22+
*
23+
* @see FormData
1824
*/
1925
public class CreateFormSubcommand extends Subcommand {
2026

src/main/java/net/discordjug/javabot/systems/staff_commands/forms/commands/DeleteFormSubcommand.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package net.discordjug.javabot.systems.staff_commands.forms.commands;
22

33
import java.util.Optional;
4+
45
import net.discordjug.javabot.systems.staff_commands.forms.dao.FormsRepository;
56
import net.discordjug.javabot.systems.staff_commands.forms.model.FormData;
67
import net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent;
@@ -15,7 +16,12 @@
1516
import xyz.dynxsty.dih4jda.interactions.commands.application.SlashCommand.Subcommand;
1617

1718
/**
18-
* The `/form delete` command.
19+
* The `/form delete` command. Deletes an existing form, also detaching it from
20+
* a message if it's attached at the time of running this command. This command
21+
* does NOT delete submission records from the database, see
22+
* {@link SubmissionsDeleteFormSubcommand}.
23+
*
24+
* @see FormData
1925
*/
2026
public class DeleteFormSubcommand extends Subcommand implements AutoCompletable {
2127

src/main/java/net/discordjug/javabot/systems/staff_commands/forms/commands/DetachFormSubcommand.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.util.List;
44
import java.util.Objects;
55
import java.util.Optional;
6+
67
import net.discordjug.javabot.systems.staff_commands.forms.FormInteractionManager;
78
import net.discordjug.javabot.systems.staff_commands.forms.dao.FormsRepository;
89
import net.discordjug.javabot.systems.staff_commands.forms.model.FormData;
@@ -24,7 +25,12 @@
2425
import xyz.dynxsty.dih4jda.util.ComponentIdBuilder;
2526

2627
/**
27-
* The `/form detach` command.
28+
* The `/form detach` command. This command detaches this form from the message
29+
* it's attached to. Detaching a form means that any buttons that could be used
30+
* to bring its input dialog will be removed. See {@link AttachFormSubcommand}
31+
* for a command for attaching the form to a message.
32+
*
33+
* @see FormData
2834
*/
2935
public class DetachFormSubcommand extends Subcommand implements AutoCompletable {
3036

src/main/java/net/discordjug/javabot/systems/staff_commands/forms/commands/DetailsFormSubcommand.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.time.Instant;
44
import java.util.Optional;
5+
56
import net.discordjug.javabot.systems.staff_commands.forms.dao.FormsRepository;
67
import net.discordjug.javabot.systems.staff_commands.forms.model.FormData;
78
import net.dv8tion.jda.api.EmbedBuilder;
@@ -20,7 +21,11 @@
2021
import xyz.dynxsty.dih4jda.interactions.commands.application.SlashCommand.Subcommand;
2122

2223
/**
23-
* The `/form details` command.
24+
* The `/form details` command. Displays information about the specified form.
25+
* The information is sent as a non-ephemeral embed in the same channel this
26+
* command is executed in.
27+
*
28+
* @see FormData
2429
*/
2530
public class DetailsFormSubcommand extends Subcommand implements AutoCompletable {
2631

src/main/java/net/discordjug/javabot/systems/staff_commands/forms/commands/ModifyFormSubcommand.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.time.Instant;
44
import java.util.Optional;
5+
56
import net.discordjug.javabot.systems.staff_commands.forms.FormInteractionManager;
67
import net.discordjug.javabot.systems.staff_commands.forms.dao.FormsRepository;
78
import net.discordjug.javabot.systems.staff_commands.forms.model.FormData;
@@ -17,7 +18,9 @@
1718
import xyz.dynxsty.dih4jda.interactions.commands.application.SlashCommand.Subcommand;
1819

1920
/**
20-
* The `/form modify` command.
21+
* The `/form modify` command. Modifies attributes of an existing form.
22+
*
23+
* @see FormData
2124
*/
2225
public class ModifyFormSubcommand extends Subcommand implements AutoCompletable {
2326

@@ -33,7 +36,6 @@ public ModifyFormSubcommand(FormsRepository formsRepo) {
3336
setCommandData(new SubcommandData("modify", "Modify an existing form").addOptions(
3437
new OptionData(OptionType.INTEGER, "form-id", "ID of the form to modify", true, true),
3538
new OptionData(OptionType.STRING, "title", "Form title (shown in modal)"),
36-
new OptionData(OptionType.STRING, "json", "Form inputs data"),
3739
new OptionData(OptionType.CHANNEL, "submit-channel", "Channel to log form submissions in"),
3840
new OptionData(OptionType.STRING, "submit-message",
3941
"Message displayed to the user once they submit the form"),

src/main/java/net/discordjug/javabot/systems/staff_commands/forms/commands/RemoveFieldFormSubcommand.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.util.ArrayList;
44
import java.util.List;
55
import java.util.Optional;
6+
67
import net.discordjug.javabot.systems.staff_commands.forms.dao.FormsRepository;
78
import net.discordjug.javabot.systems.staff_commands.forms.model.FormData;
89
import net.discordjug.javabot.systems.staff_commands.forms.model.FormField;
@@ -17,7 +18,10 @@
1718
import xyz.dynxsty.dih4jda.interactions.commands.application.SlashCommand.Subcommand;
1819

1920
/**
20-
* The `/form remove-field` command.
21+
* The `/form remove-field` command. This command removes a field from the form.
22+
*
23+
* @see AddFieldFormSubcommand
24+
* @see FormData
2125
*/
2226
public class RemoveFieldFormSubcommand extends Subcommand implements AutoCompletable {
2327

src/main/java/net/discordjug/javabot/systems/staff_commands/forms/commands/ReopenFormSubcommand.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package net.discordjug.javabot.systems.staff_commands.forms.commands;
22

33
import java.util.Optional;
4+
45
import net.discordjug.javabot.data.config.BotConfig;
56
import net.discordjug.javabot.systems.staff_commands.forms.FormInteractionManager;
67
import net.discordjug.javabot.systems.staff_commands.forms.dao.FormsRepository;
@@ -17,7 +18,10 @@
1718
import xyz.dynxsty.dih4jda.interactions.commands.application.SlashCommand.Subcommand;
1819

1920
/**
20-
* The `/form reopen` command.
21+
* The `/form reopen` command. Reopens a closed form, allowing new submissions.
22+
*
23+
* @see CloseFormSubcommandr
24+
* @see FormData
2125
*/
2226
public class ReopenFormSubcommand extends Subcommand implements AutoCompletable {
2327

0 commit comments

Comments
 (0)