From 4540bdef99731089a8baf602f332b6bae99fd960 Mon Sep 17 00:00:00 2001 From: Liam Date: Tue, 2 Jul 2024 21:30:10 +0100 Subject: [PATCH] add tos and privacy policy to the help cmd --- src/main/java/cc/fascinated/bat/Consts.java | 4 ++- .../base/commands/general/HelpCommand.java | 31 ++++++++++++------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/main/java/cc/fascinated/bat/Consts.java b/src/main/java/cc/fascinated/bat/Consts.java index 4fd9722..19a42e0 100644 --- a/src/main/java/cc/fascinated/bat/Consts.java +++ b/src/main/java/cc/fascinated/bat/Consts.java @@ -6,5 +6,7 @@ package cc.fascinated.bat; public class Consts { public static final String INVITE_URL = "https://discord.com/oauth2/authorize?client_id=1254161119975833652&permissions=8&integration_type=0&scope=bot+applications.commands"; public static final String SUPPORT_INVITE_URL = "https://discord.gg/invite/yjj2U3ctEG"; - public static String BOT_OWNER = "474221560031608833"; + public static final String BOT_OWNER = "474221560031608833"; + public static final String PRIVACY_POLICY_URL = "https://git.fascinated.cc/Fascinated/Bat/raw/branch/master/privacy-policy.txt"; + public static final String TERMS_OF_SERVICE_URL = "https://git.fascinated.cc/Fascinated/Bat/raw/branch/master/terms-of-service.txt"; } diff --git a/src/main/java/cc/fascinated/bat/features/base/commands/general/HelpCommand.java b/src/main/java/cc/fascinated/bat/features/base/commands/general/HelpCommand.java index af95938..0367a2e 100644 --- a/src/main/java/cc/fascinated/bat/features/base/commands/general/HelpCommand.java +++ b/src/main/java/cc/fascinated/bat/features/base/commands/general/HelpCommand.java @@ -63,30 +63,30 @@ public class HelpCommand extends BatCommand implements EventListener { return; } - String commands = ""; + StringBuilder commands = new StringBuilder(); List categoryCommands = commandService.getCommandsByCategory(category, true); if (categoryCommands.isEmpty()) { - commands = "No commands available in this category."; + commands = new StringBuilder("No commands available in this category."); } else { for (BatCommand command : categoryCommands) { if (!command.getSubCommands().isEmpty()) { for (Map.Entry entry : command.getSubCommands().entrySet()) { BatSubCommand subCommand = entry.getValue(); SubcommandData commandData = subCommand.getCommandData(); - commands += " - %s\n".formatted( + commands.append(" - %s\n".formatted( command.getCommandInfo().name(), commandData.getName(), subCommand.getCommandSnowflake(), commandData.getDescription() - ); + )); } continue; } - commands += " - %s\n".formatted( + commands.append(" - %s\n".formatted( command.getCommandInfo().name(), command.getCommandSnowflake(), command.getCommandInfo().description() - ); + )); } } @@ -98,7 +98,7 @@ public class HelpCommand extends BatCommand implements EventListener { categoryCommands.size() == 1 ? "" : "s", subCommands, subCommands == 1 ? "" : "s", - commands + commands.toString() )).build()).queue(); } @@ -108,18 +108,27 @@ public class HelpCommand extends BatCommand implements EventListener { * @return The home embed */ private MessageEmbed createHomeEmbed() { - String categories = ""; + StringBuilder categories = new StringBuilder(); for (Category category : Category.getCategories()) { long commandCount = commandService.getCommandsByCategory(category, true).size(); - categories += "➜ %s - **%s Command%s**\n".formatted( + categories.append("➜ %s - **%s Command%s**\n".formatted( category.getName(), commandCount, commandCount == 1 ? "" : "s" - ); + )); } return EmbedUtils.genericEmbed() - .setDescription("Here are the available command categories: \n\n" + categories) + .setDescription(""" + **Welcome to the Bat Help Menu!** + + %s + *View our [TOS](%s) and [Privacy Policy](%s) for more information.* + """.formatted( + categories.toString(), + Consts.TERMS_OF_SERVICE_URL, + Consts.PRIVACY_POLICY_URL + )) .build(); }