Skip to content

Commit 8ff8238

Browse files
committed
Made `/help-guidelines and `/help-ping subcommands of `/help
1 parent ab2c5d3 commit 8ff8238

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

src/main/java/net/javadiscord/javabot/systems/help/commands/HelpCommand.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,20 @@
33
import com.dynxsty.dih4jda.interactions.commands.SlashCommand;
44
import net.dv8tion.jda.api.interactions.commands.build.Commands;
55
import net.javadiscord.javabot.systems.help.commands.subcommands.HelpAccountSubcommand;
6+
import net.javadiscord.javabot.systems.help.commands.subcommands.HelpGuidelinesCommand;
7+
import net.javadiscord.javabot.systems.help.commands.subcommands.HelpPingCommand;
68

79
/**
8-
* Represents the `/help` command. This holds commands for a user's Help Account.
10+
* Represents the `/help` command. This holds commands related to the help system.
911
*/
1012
public class HelpCommand extends SlashCommand {
1113
/**
1214
* The constructor of this class, which sets the corresponding {@link net.dv8tion.jda.api.interactions.commands.build.SlashCommandData}.
1315
*/
1416
public HelpCommand() {
15-
setSlashCommandData(Commands.slash("help", "Commands for managing your Help Account.")
17+
setSlashCommandData(Commands.slash("help", "Commands related to the help system.")
1618
.setGuildOnly(true)
1719
);
18-
addSubcommands(new HelpAccountSubcommand());
20+
addSubcommands(new HelpAccountSubcommand(), new HelpPingCommand(), new HelpGuidelinesCommand());
1921
}
2022
}

src/main/java/net/javadiscord/javabot/systems/help/commands/HelpGuidelinesCommand.java renamed to src/main/java/net/javadiscord/javabot/systems/help/commands/subcommands/HelpGuidelinesCommand.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
package net.javadiscord.javabot.systems.help.commands;
1+
package net.javadiscord.javabot.systems.help.commands.subcommands;
22

33
import com.dynxsty.dih4jda.interactions.commands.SlashCommand;
44
import net.dv8tion.jda.api.EmbedBuilder;
55
import net.dv8tion.jda.api.entities.GuildChannel;
66
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
77
import net.dv8tion.jda.api.interactions.commands.build.Commands;
8+
import net.dv8tion.jda.api.interactions.commands.build.SubcommandData;
89
import net.javadiscord.javabot.Bot;
910
import net.javadiscord.javabot.data.config.guild.HelpConfig;
1011
import net.javadiscord.javabot.util.Responses;
@@ -16,14 +17,12 @@
1617
/**
1718
* Shows the server's help-guidelines.
1819
*/
19-
public class HelpGuidelinesCommand extends SlashCommand {
20+
public class HelpGuidelinesCommand extends SlashCommand.Subcommand {
2021
/**
2122
* The constructor of this class, which sets the corresponding {@link net.dv8tion.jda.api.interactions.commands.build.SlashCommandData}.
2223
*/
2324
public HelpGuidelinesCommand() {
24-
setSlashCommandData(Commands.slash("help-guidelines", "Show the server's help guidelines in a simple format.")
25-
.setGuildOnly(true)
26-
);
25+
setSubcommandData(new SubcommandData("guidelines", "Show the server's help guidelines in a simple format."));
2726
}
2827

2928
@Override

src/main/java/net/javadiscord/javabot/systems/help/commands/HelpPingCommand.java renamed to src/main/java/net/javadiscord/javabot/systems/help/commands/subcommands/HelpPingCommand.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
package net.javadiscord.javabot.systems.help.commands;
1+
package net.javadiscord.javabot.systems.help.commands.subcommands;
22

33
import com.dynxsty.dih4jda.interactions.commands.SlashCommand;
44
import net.dv8tion.jda.api.EmbedBuilder;
55
import net.dv8tion.jda.api.entities.*;
66
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
77
import net.dv8tion.jda.api.interactions.commands.build.Commands;
8+
import net.dv8tion.jda.api.interactions.commands.build.SubcommandData;
89
import net.javadiscord.javabot.Bot;
910
import net.javadiscord.javabot.data.config.GuildConfig;
1011
import net.javadiscord.javabot.data.config.guild.HelpConfig;
@@ -19,10 +20,10 @@
1920
import java.util.concurrent.TimeUnit;
2021

2122
/**
22-
* Handler for the /help-ping command that allows users to occasionally ping
23+
* Handler for the /help ping sub-command that allows users to occasionally ping
2324
* helpers.
2425
*/
25-
public class HelpPingCommand extends SlashCommand {
26+
public class HelpPingCommand extends SlashCommand.Subcommand {
2627
private static final String WRONG_CHANNEL_MSG = "This command can only be used in **reserved help channels**.";
2728
private static final long CACHE_CLEANUP_DELAY = 60L;
2829

@@ -32,7 +33,7 @@ public class HelpPingCommand extends SlashCommand {
3233
* Constructor that initializes and handles the cooldown map.
3334
*/
3435
public HelpPingCommand() {
35-
setSlashCommandData(Commands.slash("help-ping", "Notify those with the help-ping role that your question is urgent."));
36+
setSubcommandData(new SubcommandData("ping", "Notify those with the help-ping role that your question is urgent."));
3637
lastPingTimes = new ConcurrentHashMap<>();
3738
Bot.getAsyncPool().scheduleWithFixedDelay(this::cleanTimeoutCache, CACHE_CLEANUP_DELAY, CACHE_CLEANUP_DELAY, TimeUnit.SECONDS);
3839
}

0 commit comments

Comments
 (0)