added templates parameters for help

This commit is contained in:
Sheldan
2020-05-14 18:53:09 +02:00
parent 3f6d980c4c
commit e4efc26740
125 changed files with 151 additions and 73 deletions

View File

@@ -33,8 +33,8 @@ public class AddToChannelGroup extends AbstractConditionableCommand {
@Override
public CommandConfiguration getConfiguration() {
Parameter channelGroupName = Parameter.builder().name("name").type(String.class).description("The name of the channel group to add the channel to.").build();
Parameter channelToAdd = Parameter.builder().name("channel").type(TextChannel.class).description("The mention of the channel to add to the group.").build();
Parameter channelGroupName = Parameter.builder().name("name").type(String.class).templated(true).build();
Parameter channelToAdd = Parameter.builder().name("channel").type(TextChannel.class).templated(true).build();
List<Parameter> parameters = Arrays.asList(channelGroupName, channelToAdd);
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();
List<String> aliases = Arrays.asList("addTChGrp", "chGrpCh+");

View File

@@ -30,7 +30,7 @@ public class CreateChannelGroup extends AbstractConditionableCommand {
@Override
public CommandConfiguration getConfiguration() {
Parameter channelGroupName = Parameter.builder().name("name").type(String.class).description("The name of the channel group to create.").build();
Parameter channelGroupName = Parameter.builder().name("name").type(String.class).templated(true).build();
List<Parameter> parameters = Arrays.asList(channelGroupName);
List<String> aliases = Arrays.asList("+ChGroup");
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();

View File

@@ -30,7 +30,7 @@ public class DeleteChannelGroup extends AbstractConditionableCommand {
@Override
public CommandConfiguration getConfiguration() {
Parameter channelGroupName = Parameter.builder().name("name").type(String.class).description("The name of the channel group to delete.").build();
Parameter channelGroupName = Parameter.builder().name("name").type(String.class).templated(true).build();
List<Parameter> parameters = Arrays.asList(channelGroupName);
List<String> aliases = Arrays.asList("-ChGroup");
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();

View File

@@ -32,8 +32,8 @@ public class DisableCommand extends AbstractConditionableCommand {
@Override
public CommandConfiguration getConfiguration() {
Parameter channelGroupName = Parameter.builder().name("commandName").type(String.class).description("The name of the channel group to add the channel to.").build();
Parameter channelToAdd = Parameter.builder().name("channelGroup").type(String.class).description("The name of the channel group in which the command should be disabled.").build();
Parameter channelGroupName = Parameter.builder().name("commandName").type(String.class).templated(true).build();
Parameter channelToAdd = Parameter.builder().name("channelGroupName").type(String.class).templated(true).build();
List<Parameter> parameters = Arrays.asList(channelGroupName, channelToAdd);
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();
return CommandConfiguration.builder()

View File

@@ -32,8 +32,8 @@ public class EnableCommand extends AbstractConditionableCommand {
@Override
public CommandConfiguration getConfiguration() {
Parameter channelGroupName = Parameter.builder().name("commandName").type(String.class).description("The name of the channel group to add the channel to.").build();
Parameter channelToAdd = Parameter.builder().name("channelGroup").type(String.class).description("The name of the channel group in which the command should be disabled.").build();
Parameter channelGroupName = Parameter.builder().name("commandName").type(String.class).templated(true).build();
Parameter channelToAdd = Parameter.builder().name("channelGroupName").type(String.class).templated(true).build();
List<Parameter> parameters = Arrays.asList(channelGroupName, channelToAdd);
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();
return CommandConfiguration.builder()

View File

@@ -61,8 +61,8 @@ public class PostTarget extends AbstractConditionableCommand {
@Override
public CommandConfiguration getConfiguration() {
Parameter channel = Parameter.builder().name("channel").type(TextChannel.class).optional(true).description("The channel to post towards").build();
Parameter postTargetName = Parameter.builder().name("name").type(String.class).optional(true).description("The name of the post target to redirect").build();
Parameter postTargetName = Parameter.builder().name("name").type(String.class).optional(true).templated(true).build();
Parameter channel = Parameter.builder().name("channel").type(TextChannel.class).optional(true).templated(true).build();
List<Parameter> parameters = Arrays.asList(postTargetName, channel);
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();
return CommandConfiguration.builder()

View File

@@ -33,8 +33,8 @@ public class SetConfig extends AbstractConditionableCommand {
@Override
public CommandConfiguration getConfiguration() {
Parameter keyToChange = Parameter.builder().name("key").type(String.class).description("The key to change.").build();
Parameter valueToSet = Parameter.builder().name("value").type(String.class).description("The value to set the key to.").build();
Parameter keyToChange = Parameter.builder().name("key").type(String.class).templated(true).build();
Parameter valueToSet = Parameter.builder().name("value").type(String.class).templated(true).build();
List<Parameter> parameters = Arrays.asList(keyToChange, valueToSet);
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();
return CommandConfiguration.builder()

View File

@@ -30,7 +30,7 @@ public class SetPrefix extends AbstractConditionableCommand {
@Override
public CommandConfiguration getConfiguration() {
Parameter newPrefixParameter = Parameter.builder().name("prefix").type(String.class).description("The new prefix to be used for this server.").build();
Parameter newPrefixParameter = Parameter.builder().name("prefix").type(String.class).templated(true).build();
List<Parameter> parameters = Arrays.asList(newPrefixParameter);
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();
return CommandConfiguration.builder()

View File

@@ -59,7 +59,7 @@ public class Allow extends AbstractConditionableCommand {
@Override
public CommandConfiguration getConfiguration() {
Parameter featureName = Parameter.builder().name("feature|commandName").type(String.class).description("The command/feature name to allow for anyone to execute.").build();
Parameter featureName = Parameter.builder().name("component").templated(true).type(String.class).build();
List<Parameter> parameters = Arrays.asList(featureName);
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();
return CommandConfiguration.builder()

View File

@@ -63,8 +63,8 @@ public class AllowRole extends AbstractConditionableCommand {
@Override
public CommandConfiguration getConfiguration() {
Parameter featureName = Parameter.builder().name("feature|commandName").type(String.class).description("The command/feature the role should be able to execute.").build();
Parameter role = Parameter.builder().name("role").type(ARole.class).description("The role to allow it for.").build();
Parameter featureName = Parameter.builder().name("component").type(String.class).templated(true).build();
Parameter role = Parameter.builder().name("role").type(ARole.class).templated(true).build();
List<Parameter> parameters = Arrays.asList(featureName, role);
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();
return CommandConfiguration.builder()

View File

@@ -61,8 +61,8 @@ public class DisAllowRole extends AbstractConditionableCommand {
@Override
public CommandConfiguration getConfiguration() {
Parameter featureName = Parameter.builder().name("feature|commandName").type(String.class).description("The command/feature the role should not be able to execute.").build();
Parameter role = Parameter.builder().name("role").type(ARole.class).description("The roleId to disallow it for.").build();
Parameter featureName = Parameter.builder().name("component").type(String.class).templated(true).build();
Parameter role = Parameter.builder().name("role").type(ARole.class).templated(true).build();
List<Parameter> parameters = Arrays.asList(featureName, role);
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();
return CommandConfiguration.builder()

View File

@@ -57,7 +57,7 @@ public class Disable extends AbstractConditionableCommand {
@Override
public CommandConfiguration getConfiguration() {
Parameter featureName = Parameter.builder().name("featureName").type(String.class).optional(true).description("The feature to disable.").build();
Parameter featureName = Parameter.builder().name("featureName").templated(true).type(String.class).optional(true).build();
List<Parameter> parameters = Arrays.asList(featureName);
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();
return CommandConfiguration.builder()

View File

@@ -56,7 +56,7 @@ public class Enable extends AbstractConditionableCommand {
@Override
public CommandConfiguration getConfiguration() {
Parameter featureName = Parameter.builder().name("featureName").type(String.class).optional(true).description("The feature to enable.").build();
Parameter featureName = Parameter.builder().name("featureName").type(String.class).optional(true).templated(true).build();
List<Parameter> parameters = Arrays.asList(featureName);
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();
return CommandConfiguration.builder()

View File

@@ -61,8 +61,8 @@ public class MakeAffected extends AbstractConditionableCommand {
@Override
public CommandConfiguration getConfiguration() {
Parameter featureName = Parameter.builder().name("feature|commandName").type(String.class).description("The command/feature name to make the role affected by.").build();
Parameter role = Parameter.builder().name("role").type(ARole.class).description("The role to make affected.").build();
Parameter featureName = Parameter.builder().name("component").type(String.class).templated(true).build();
Parameter role = Parameter.builder().name("role").type(ARole.class).templated(true).build();
List<Parameter> parameters = Arrays.asList(featureName, role);
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();
return CommandConfiguration.builder()

View File

@@ -61,8 +61,8 @@ public class MakeImmune extends AbstractConditionableCommand {
@Override
public CommandConfiguration getConfiguration() {
Parameter featureName = Parameter.builder().name("feature|commandName").type(String.class).description("The command/feature name to make the role immune for.").build();
Parameter role = Parameter.builder().name("role").type(ARole.class).description("The roleId to make immune.").build();
Parameter featureName = Parameter.builder().name("component").type(String.class).templated(true).build();
Parameter role = Parameter.builder().name("role").type(ARole.class).templated(true).build();
List<Parameter> parameters = Arrays.asList(featureName, role);
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();
return CommandConfiguration.builder()

View File

@@ -59,7 +59,7 @@ public class Restrict extends AbstractConditionableCommand {
@Override
public CommandConfiguration getConfiguration() {
Parameter featureName = Parameter.builder().name("feature|commandName").type(String.class).description("The command/feature name to restrict.").build();
Parameter featureName = Parameter.builder().name("component").type(String.class).templated(true).build();
List<Parameter> parameters = Arrays.asList(featureName);
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();
return CommandConfiguration.builder()

View File

@@ -111,13 +111,13 @@ public class Help implements Command {
Parameter moduleOrCommandName = Parameter.builder()
.name("name")
.optional(true)
.description("Name of module or command")
.templated(true)
.type(String.class)
.build();
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();
return CommandConfiguration.builder()
.name("help")
.module("support")
.module(SupportModuleInterface.SUPPORT)
.parameters(Collections.singletonList(moduleOrCommandName))
.help(helpInfo)
.templated(true)

View File

@@ -8,9 +8,11 @@ import org.springframework.stereotype.Component;
public class SupportModuleInterface implements ModuleInterface {
public static final String SUPPORT = "support";
@Override
public ModuleInfo getInfo() {
return ModuleInfo.builder().name("support").description("Utilities for support").build();
return ModuleInfo.builder().name(SUPPORT).description("Utilities for support").build();
}
@Override

View File

@@ -38,7 +38,7 @@ public class Echo extends AbstractConditionableCommand {
@Override
public CommandConfiguration getConfiguration() {
List<Parameter> parameters = new ArrayList<>();
parameters.add(Parameter.builder().name("input").type(String.class).remainder(true).build());
parameters.add(Parameter.builder().name("input").type(String.class).templated(true).remainder(true).build());
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();
return CommandConfiguration.builder()
.name("echo")

View File

@@ -40,8 +40,8 @@ public class SetEmote extends AbstractConditionableCommand {
@Override
public CommandConfiguration getConfiguration() {
Parameter emoteKey = Parameter.builder().name("emoteKey").type(String.class).description("The internal key of the emote").build();
Parameter emote = Parameter.builder().name("emote").type(net.dv8tion.jda.api.entities.Emote.class).description("The emote to be used").build();
Parameter emoteKey = Parameter.builder().name("emoteKey").type(String.class).templated(true).build();
Parameter emote = Parameter.builder().name("emote").type(net.dv8tion.jda.api.entities.Emote.class).templated(true).build();
List<Parameter> parameters = Arrays.asList(emoteKey, emote);
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();
return CommandConfiguration.builder()

View File

@@ -32,7 +32,7 @@
<#include "help_command_embed_command_parameters">:
<#if command.parameters??>
<#list command.parameters as parameter>
<#include "help_command_embed_command_description"> `${parameter.name}`: ${(parameter.description)!""}
<#include "help_command_embed_command_description"> `${parameter.name}`: <#if parameter.templated?? && parameter.templated><#include "${command.name}_parameter_${parameter.name}"><#else>${(parameter.description)!""}</#if>
<#include "help_command_embed_command_optional"><#sep>
<#else>