forked from Fascinated/Bat
add tos and privacy policy to the help cmd
This commit is contained in:
parent
eda4eb5973
commit
4540bdef99
@ -6,5 +6,7 @@ package cc.fascinated.bat;
|
|||||||
public class Consts {
|
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 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 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";
|
||||||
}
|
}
|
||||||
|
@ -63,30 +63,30 @@ public class HelpCommand extends BatCommand implements EventListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String commands = "";
|
StringBuilder commands = new StringBuilder();
|
||||||
List<BatCommand> categoryCommands = commandService.getCommandsByCategory(category, true);
|
List<BatCommand> categoryCommands = commandService.getCommandsByCategory(category, true);
|
||||||
if (categoryCommands.isEmpty()) {
|
if (categoryCommands.isEmpty()) {
|
||||||
commands = "No commands available in this category.";
|
commands = new StringBuilder("No commands available in this category.");
|
||||||
} else {
|
} else {
|
||||||
for (BatCommand command : categoryCommands) {
|
for (BatCommand command : categoryCommands) {
|
||||||
if (!command.getSubCommands().isEmpty()) {
|
if (!command.getSubCommands().isEmpty()) {
|
||||||
for (Map.Entry<String, BatSubCommand> entry : command.getSubCommands().entrySet()) {
|
for (Map.Entry<String, BatSubCommand> entry : command.getSubCommands().entrySet()) {
|
||||||
BatSubCommand subCommand = entry.getValue();
|
BatSubCommand subCommand = entry.getValue();
|
||||||
SubcommandData commandData = subCommand.getCommandData();
|
SubcommandData commandData = subCommand.getCommandData();
|
||||||
commands += "</%s %s:%s> - %s\n".formatted(
|
commands.append("</%s %s:%s> - %s\n".formatted(
|
||||||
command.getCommandInfo().name(),
|
command.getCommandInfo().name(),
|
||||||
commandData.getName(),
|
commandData.getName(),
|
||||||
subCommand.getCommandSnowflake(),
|
subCommand.getCommandSnowflake(),
|
||||||
commandData.getDescription()
|
commandData.getDescription()
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
commands += "</%s:%s> - %s\n".formatted(
|
commands.append("</%s:%s> - %s\n".formatted(
|
||||||
command.getCommandInfo().name(),
|
command.getCommandInfo().name(),
|
||||||
command.getCommandSnowflake(),
|
command.getCommandSnowflake(),
|
||||||
command.getCommandInfo().description()
|
command.getCommandInfo().description()
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ public class HelpCommand extends BatCommand implements EventListener {
|
|||||||
categoryCommands.size() == 1 ? "" : "s",
|
categoryCommands.size() == 1 ? "" : "s",
|
||||||
subCommands,
|
subCommands,
|
||||||
subCommands == 1 ? "" : "s",
|
subCommands == 1 ? "" : "s",
|
||||||
commands
|
commands.toString()
|
||||||
)).build()).queue();
|
)).build()).queue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,18 +108,27 @@ public class HelpCommand extends BatCommand implements EventListener {
|
|||||||
* @return The home embed
|
* @return The home embed
|
||||||
*/
|
*/
|
||||||
private MessageEmbed createHomeEmbed() {
|
private MessageEmbed createHomeEmbed() {
|
||||||
String categories = "";
|
StringBuilder categories = new StringBuilder();
|
||||||
for (Category category : Category.getCategories()) {
|
for (Category category : Category.getCategories()) {
|
||||||
long commandCount = commandService.getCommandsByCategory(category, true).size();
|
long commandCount = commandService.getCommandsByCategory(category, true).size();
|
||||||
categories += "➜ %s - **%s Command%s**\n".formatted(
|
categories.append("➜ %s - **%s Command%s**\n".formatted(
|
||||||
category.getName(),
|
category.getName(),
|
||||||
commandCount,
|
commandCount,
|
||||||
commandCount == 1 ? "" : "s"
|
commandCount == 1 ? "" : "s"
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
return EmbedUtils.genericEmbed()
|
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();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user