[OPB-25] implementation of FAQ commands

This commit is contained in:
Sheldan
2021-06-10 01:11:51 +02:00
parent 377b4ef478
commit f943247e7d
157 changed files with 5106 additions and 10 deletions

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>oneplus-bot-modules-templates</artifactId>
<groupId>dev.sheldan.oneplus.bot.templates.modules</groupId>
<version>1.4.4-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>faq-templates</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>faq-templates-${project.version}</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/assembly/assembly.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,15 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>zip</id>
<includeBaseDirectory>false</includeBaseDirectory>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<outputDirectory>.</outputDirectory>
<directory>${project.basedir}/src/main/resources</directory>
</fileSet>
</fileSets>
</assembly>

View File

@@ -0,0 +1,14 @@
{
<#include "abstracto_color">,
"description": "
<#list uses as usage>
<#assign usage=usage>
<#assign commandName=usage.faqCommandName><@safe_include "FAQUsage_command_display"/>:
<#list usage.faqChannelGroupUsages as channelGroupUsage>
<#assign channelGroupUsage=channelGroupUsage>
<#assign channelGroupName=channelGroupUsage.channelGroupName>
<#assign uses=channelGroupUsage.uses>
<@safe_include "FAQUsage_usage_display"/><#sep>, </#list>
<#else>
<@safe_include "FAQUsage_no_usages"/></#list>"
}

View File

@@ -0,0 +1,21 @@
{
<#if additionalMessage??>
"additionalMessage": "${additionalMessage?json_string}"
</#if>
<#if description?? || imageURL??>
<#include "user_author">
<#if additionalMessage??>,</#if>
<@user_author user=author/>
<#if description??>
,"description": "${description?json_string}"
</#if>
,"color" : {
"r": "${red}",
"g": "${green}",
"b": "${blue}"
}
<#if imageURL??>
,"imageUrl": "${imageURL}"
</#if>
</#if>
}

View File

@@ -0,0 +1,4 @@
{
"additionalMessage": "<@safe_include "FAQ_response_no_command_found_message"/>
<#if availableCommands?size gt 0><#assign commandNames>`${availableCommands?join('`, `')}`</#assign><@safe_include "FAQ_response_no_command_found_message_available_commands"/><#else><@safe_include "FAQ_response_no_command_found_message_no_commands"/></#if>"
}

View File

@@ -0,0 +1,20 @@
{
<#include "abstracto_color">,
"description": "
<@safe_include "listFAQCommands_command_header"/>
<#list commands as command>
<#assign command=command>
<#assign aliases>${command.aliases?join(', ')}</#assign>
<#assign commandName=command.commandName><@safe_include "listFAQCommands_command_display"/>
<#if command.aliases?size gt 0> <@safe_include "listFAQCommands_channel_group_display_aliases"/></#if>
<@safe_include "listFAQCommands_channel_groups_header"/>
<#list command.channelGroups as channelGroup>
<#assign channelGroup=channelGroup>
<#assign channelGroupName=channelGroup.channelGroupName>
<#assign responseCount=channelGroup.responseCount>
<@safe_include "listFAQCommands_channel_group_display"/><#sep>, </#list>
<#else>
<@safe_include "listFAQCommands_no_commands"/></#list>"
}

View File

@@ -0,0 +1,2 @@
<#assign commandKeys>${model.duplicatedCommandKeys?join(', ')}</#assign>
<#include "duplicated_command_or_alias_exception_message">

View File

@@ -0,0 +1,4 @@
<#assign commandName=model.commandName>
<#assign aliasName=model.alias>
<#assign originalCommandName=model.originCommandName>
<#include "duplicated_faq_command_alias_exception_message">

View File

@@ -0,0 +1,3 @@
<#assign commandName=model.commandName>
<#assign aliasName=model.alias>
<#include "faq_command_alias_shadowing_exception_message">

View File

@@ -0,0 +1,2 @@
<#assign commandName=model.commandName>
<#include "faq_command_not_found_exception_message">

View File

@@ -0,0 +1,3 @@
<#assign commandName=model.commandName>
<#assign channelGroupName=model.channelGroupName>
<#include "faq_command_response_duplicated_position_exception_message">

View File

@@ -0,0 +1,2 @@
<#assign commandName=model.commandName>
<#include "global_faq_command_config_mismatch_exception_message">

View File

@@ -0,0 +1,2 @@
<#assign commandNames>${model.commandNames?join(', ')}</#assign>
<#include "global_faq_command_responses_exception_message">

View File

@@ -0,0 +1 @@
<#include "no_faq_response_found_exception_message">

View File

@@ -22,7 +22,7 @@
<goal>single</goal>
</goals>
<configuration>
<finalName>starboard-custom-templates-${project.version}</finalName>
<finalName>news-templates-${project.version}</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/assembly/assembly.xml</descriptor>

View File

@@ -15,6 +15,7 @@
<module>starboard-custom-templates</module>
<module>news-templates</module>
<module>referral-templates</module>
<module>faq-templates</module>
</modules>

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>translations</artifactId>
<groupId>dev.sheldan.oneplus.bot.templates.translations</groupId>
<version>1.4.4-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>faq-translations</artifactId>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>faq-translations-${project.version}</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/assembly/assembly.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,15 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>zip</id>
<includeBaseDirectory>false</includeBaseDirectory>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<outputDirectory>.</outputDirectory>
<directory>${project.basedir}/src/main/resources</directory>
</fileSet>
</fileSets>
</assembly>

View File

@@ -0,0 +1 @@
The following commands are available in the given channel: ${commandNames}.

View File

@@ -0,0 +1 @@
Shows pre configured responses for different commands in different channels

View File

@@ -0,0 +1,3 @@
This command can be used to show frequently asked questions in different channels.
The response depends on the channels it is executed in, if the command is not available in the channel, the available commands are shown.
It is possible to define a channel to get the response for, if the channel is not provided the current channel is used.

View File

@@ -0,0 +1 @@
The channel to get the FAQ response in

View File

@@ -0,0 +1 @@
The name of the FAQ command to show

View File

@@ -0,0 +1 @@
Shows the amount of times faq commands have been used

View File

@@ -0,0 +1,2 @@
This command can be used to show the amount of times each FAQ command response was shown to users.
The tracking only works for the current FAQ commands, and if the response is deleted the usage is also deleted.

View File

@@ -0,0 +1,2 @@
This command can be used to delete a complete FAQ command and all of its responses.
This is a destructive action to use with care.

View File

@@ -0,0 +1 @@
Exports the FAQ configuration into JSON format

View File

@@ -0,0 +1,2 @@
This command can be used to export the current FAQ configuration into the JSON format required for importing it.
There is an optional parameter to only export the FAQ configuration of one specific command. Without this parameter, all commands are exported.

View File

@@ -0,0 +1 @@
The FAQ command to export the configuration for

View File

@@ -0,0 +1 @@
Updates the current FAQ configuration for this server

View File

@@ -0,0 +1 @@
This command is used to update the current FAQ configuration. It uses a file, containing the configuration as a parameter.

View File

@@ -0,0 +1 @@
The JSON file containing the FAQ configuration as attachment

View File

@@ -0,0 +1 @@
This command can be used to show the currently configured FAQ commands, the channel groups they have responses in and how many responses there are.

View File

@@ -0,0 +1 @@
Module containing FAQ related commands

View File

@@ -0,0 +1 @@
Global channel group will be created for the purpose of global faq commands.

View File

@@ -0,0 +1 @@
The commands ${commandKeys} have duplicates names for command or aliases.

View File

@@ -0,0 +1 @@
The alias ${aliasName} in command ${commandName} is duplicated in command ${originalCommandName}.

View File

@@ -0,0 +1 @@
Alias ${aliasName} in command ${commandName} shadows another command.

View File

@@ -0,0 +1 @@
FAQ command ${commandName} was not found.

View File

@@ -0,0 +1 @@
A position in channel group ${channelGroupName} of FAQ command ${commandName} is duplicated.

View File

@@ -0,0 +1,2 @@
The configuration for global command ${commandName} is mismatched.
It needs to be configured as `"global": true` and the only response needs to be a channel group with name `global`.

View File

@@ -0,0 +1 @@
The FAQ commands ${commandNames} are configured as global, but they do have more than one response configured.

View File

@@ -21,7 +21,7 @@
<goal>single</goal>
</goals>
<configuration>
<finalName>news-templates-${project.version}</finalName>
<finalName>news-translations-${project.version}</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/assembly/assembly.xml</descriptor>

View File

@@ -15,5 +15,6 @@
<module>news-translations</module>
<module>setup-translations</module>
<module>referral-translations</module>
<module>faq-translations</module>
</modules>
</project>