added support for example templates/direct strings to commands who need it

added example templates for some commands
added the examples to documentation as well
This commit is contained in:
Sheldan
2020-05-16 01:20:23 +02:00
parent ddb540ccfe
commit d5007e362b
51 changed files with 80 additions and 25 deletions

View File

@@ -36,7 +36,7 @@ public class AddToChannelGroup extends AbstractConditionableCommand {
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();
HelpInfo helpInfo = HelpInfo.builder().templated(true).hasExample(true).build();
List<String> aliases = Arrays.asList("addTChGrp", "chGrpCh+");
return CommandConfiguration.builder()
.name("addToChannelGroup")

View File

@@ -35,7 +35,7 @@ public class DisableCommand extends AbstractConditionableCommand {
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();
HelpInfo helpInfo = HelpInfo.builder().templated(true).hasExample(true).build();
return CommandConfiguration.builder()
.name("disableCommand")
.module(ChannelsModuleInterface.CHANNELS)

View File

@@ -35,7 +35,7 @@ public class EnableCommand extends AbstractConditionableCommand {
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();
HelpInfo helpInfo = HelpInfo.builder().templated(true).hasExample(true).build();
return CommandConfiguration.builder()
.name("enableCommand")
.module(ChannelsModuleInterface.CHANNELS)

View File

@@ -64,7 +64,7 @@ public class PostTarget extends AbstractConditionableCommand {
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();
HelpInfo helpInfo = HelpInfo.builder().templated(true).hasExample(true).build();
return CommandConfiguration.builder()
.name("posttarget")
.module(ChannelsModuleInterface.CHANNELS)

View File

@@ -37,7 +37,7 @@ public class RemoveFromChannelGroup extends AbstractConditionableCommand {
Parameter channelToAdd = Parameter.builder().name("channel").type(TextChannel.class).description("The mention of the channel to remove from the group.").build();
List<Parameter> parameters = Arrays.asList(channelGroupName, channelToAdd);
List<String> aliases = Arrays.asList("rmChChgrp", "chGrpCh-");
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();
HelpInfo helpInfo = HelpInfo.builder().templated(true).hasExample(true).build();
return CommandConfiguration.builder()
.name("removeFromChannelGroup")
.module(ChannelsModuleInterface.CHANNELS)

View File

@@ -36,7 +36,7 @@ public class SetConfig extends AbstractConditionableCommand {
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();
HelpInfo helpInfo = HelpInfo.builder().templated(true).hasExample(true).build();
return CommandConfiguration.builder()
.name("setConfig")
.module(ConfigModuleInterface.CONFIG)

View File

@@ -65,7 +65,7 @@ public class AllowRole extends AbstractConditionableCommand {
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();
HelpInfo helpInfo = HelpInfo.builder().templated(true).hasExample(true).build();
return CommandConfiguration.builder()
.name("allowRole")
.module(ConfigModuleInterface.CONFIG)

View File

@@ -64,7 +64,7 @@ public class DisAllowRole extends AbstractConditionableCommand {
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();
HelpInfo helpInfo = HelpInfo.builder().templated(true).hasExample(true).build();
return CommandConfiguration.builder()
.name("disAllowRole")
.module(ConfigModuleInterface.CONFIG)

View File

@@ -59,7 +59,7 @@ public class Disable extends AbstractConditionableCommand {
public CommandConfiguration getConfiguration() {
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();
HelpInfo helpInfo = HelpInfo.builder().templated(true).hasExample(true).build();
return CommandConfiguration.builder()
.name("disable")
.module(ConfigModuleInterface.CONFIG)

View File

@@ -63,7 +63,7 @@ public class Enable extends AbstractConditionableCommand {
public CommandConfiguration getConfiguration() {
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();
HelpInfo helpInfo = HelpInfo.builder().templated(true).hasExample(true).build();
return CommandConfiguration.builder()
.name("enable")
.module(ConfigModuleInterface.CONFIG)

View File

@@ -64,7 +64,7 @@ public class MakeAffected extends AbstractConditionableCommand {
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();
HelpInfo helpInfo = HelpInfo.builder().templated(true).hasExample(true).build();
return CommandConfiguration.builder()
.name("makeAffected")
.module(ConfigModuleInterface.CONFIG)

View File

@@ -64,7 +64,7 @@ public class MakeImmune extends AbstractConditionableCommand {
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();
HelpInfo helpInfo = HelpInfo.builder().templated(true).hasExample(true).build();
return CommandConfiguration.builder()
.name("makeImmune")
.module(ConfigModuleInterface.CONFIG)

View File

@@ -14,9 +14,15 @@
<#if command.help.templated>
<#include "help_command_embed_command_usage">: `<#include "${command.name}_usage">`
<#include "help_command_embed_command_detailed_help">: <#include "${command.name}_long_help">
<#if command.help.hasExample>
<#include "help_command_embed_command_example">: <#include "${command.name}_example">
</#if>
<#else>
<#include "help_command_embed_command_usage">: `${command.help.usage}`
<#include "help_command_embed_command_detailed_help">: ${command.help.longHelp}
<#if command.help.hasExample>
<#include "help_command_embed_command_example">:${command.help.example}
</#if>
</#if>
<#if command.aliases?? && command.aliases?size gt 0>
<#include "help_command_embed_command_aliases">: `${command.aliases?join("`, `")}`