added templates required by assignable role places

changed the way how exceptions are templated
fixed generic exception template to handle text which might break the syntax
This commit is contained in:
Sheldan
2020-08-02 23:21:37 +02:00
parent 6565b68900
commit 48bc33860d
127 changed files with 313 additions and 7 deletions

View File

@@ -0,0 +1,38 @@
<?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>abstracto-modules</artifactId>
<groupId>dev.sheldan.abstracto-templates.templates</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>assignable-roles</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>assignable-roles-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 @@
{
"color" : {
"r": 200,
"g": 0,
"b": 255
},
"description": "<#include "assignable_roles_config_embed_place_description">
<#include "assignable_roles_config_embed_role_header">:
<#list roles as role>
<#include "assignable_roles_config_embed_emote_description">
</#list>
"
}

View File

@@ -0,0 +1,10 @@
{
"color" : {
"r": 200,
"g": 0,
"b": 255
},
"description": "<#include "assignable_role_places_overview_description">:
<#list places as place>`<#include "assignable_role_places_overview_place">`<#sep>, <#else> <#include "assignable_role_places_overview_no_places"></#list>
"
}

View File

@@ -0,0 +1 @@
"description": "<#include "assignable_role_place_assigned_user_not_found_exception_text">"

View File

@@ -0,0 +1 @@
"description": "<#include "assignable_role_place_channel_does_not_exist_exception_text">"

View File

@@ -0,0 +1 @@
"description": "<#include "assignable_role_place_emote_already_defined_exception_text">"

View File

@@ -0,0 +1 @@
"additionalMessage": "<#include "assignable_role_place_exists_exception_text">"

View File

@@ -0,0 +1 @@
"description": "<#include "assignable_role_place_not_found_exception_text">"

View File

@@ -0,0 +1 @@
"description": "<#include "assignable_role_place_post_not_found_exception_text">"

View File

@@ -0,0 +1 @@
"description": "<#include "assignable_role_place_role_not_usable_exception_text">"

View File

@@ -0,0 +1 @@
"description": "<#include "emote_not_in_assignable_role_place_exception_text">"

View File

@@ -0,0 +1,21 @@
{
"color" : {
"r": 200,
"g": 0,
"b": 255
},
"description": "${place.text}",
"fields": [
<#list roles as role>
{
"name": "${role.emote.emoteRepr}",
"value": "${role.description}",
"inline": "${place.inline?string('true', 'false')}"
<#if role.forceNewMessage>
,"forceNewMessage": "true"
</#if>
}<#sep>,
<#else>
</#list>
]
}

View File

@@ -12,14 +12,14 @@
<#if command.help??> <#if command.help??>
<#if command.help.templated> <#if command.help.templated>
<#include "help_command_embed_command_usage">: `<#include "${command.name}_usage">` **<#include "help_command_embed_command_usage">**: `<#include "${command.name}_usage">`
<#include "help_command_embed_command_detailed_help">: <#include "${command.name}_long_help"> **<#include "help_command_embed_command_detailed_help">**: <#include "${command.name}_long_help">
<#if command.help.hasExample> <#if command.help.hasExample>
<#include "help_command_embed_command_example">: <#include "${command.name}_example"> <#include "help_command_embed_command_example">: <#include "${command.name}_example">
</#if> </#if>
<#else> <#else>
<#include "help_command_embed_command_usage">: `${command.help.usage}` **<#include "help_command_embed_command_usage">**: `${command.help.usage}`
<#include "help_command_embed_command_detailed_help">: ${command.help.longHelp} **<#include "help_command_embed_command_detailed_help">**: ${command.help.longHelp}
<#if command.help.hasExample> <#if command.help.hasExample>
<#include "help_command_embed_command_example">:${command.help.example} <#include "help_command_embed_command_example">:${command.help.example}
</#if> </#if>
@@ -35,7 +35,7 @@
</#if> </#if>
</#if> </#if>
<#include "help_command_embed_command_parameters">: **<#include "help_command_embed_command_parameters">**:
<#if command.parameters??> <#if command.parameters??>
<#list command.parameters as parameter> <#list command.parameters as parameter>
<#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_description"> `${parameter.name}`: <#if parameter.templated?? && parameter.templated><#include "${command.name}_parameter_${parameter.name}"><#else>${(parameter.description)!""}</#if>

View File

@@ -1 +1 @@
The channel ${channelId} was not found in guild ${guildId}. The channel ${channelId} was not found.

View File

@@ -0,0 +1 @@
"description": "<#include "command_parameter_value_wrong_type_exception_text">"

View File

@@ -0,0 +1 @@
"description": "<#include "emote_not_available_in_server_exception_message">"

View File

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

View File

@@ -0,0 +1,23 @@
{
"author": {
"name": "${user.member.effectiveName}",
"avatar": "${user.member.user.effectiveAvatarUrl}"
},
"color" : {
"r": 200,
"g": 0,
"b": 255
},
"preventEmptyEmbed": "true",
<#if template?has_content>
<#if template.templateModel?has_content>
<#assign model=template.templateModel/>
<#assign rendered><#include "${template.templateName}"></#assign>
${rendered?js_string}
</#if>
<#elseif throwable.localizedMessage?has_content>
"description": "${throwable.localizedMessage?js_string}"
<#else>
"description": "${throwable.class.simpleName?js_string}"
</#if>
}

View File

@@ -0,0 +1 @@
"description": "<#include "role_disabled_exception_message">"

View File

@@ -21,6 +21,7 @@
<module>moderation</module> <module>moderation</module>
<module>modmail</module> <module>modmail</module>
<module>utility</module> <module>utility</module>
<module>assignable-roles</module>
</modules> </modules>
</project> </project>

View File

@@ -0,0 +1,37 @@
<?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.abstracto-templates.translations</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>assignable-roles</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>assignable-roles-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 @@
Activates an assignable role place again, meaning reacting to the reactions will assign the configured roles.

View File

@@ -0,0 +1,2 @@
Adds an assignable role to the given assignable role place. This assignment requires an emote, a description and a role to be assigned. The mentioned role will be assigned once a member reacts to the emote.
Only emotes from a server the bot is in can be used and it is not possible to assign an emote twice. The emote will be added at the _end_ of the assignable role place and if the posts already exists, the emote will be added already.

View File

@@ -0,0 +1 @@
The description of the role to be displayed next to the emote in the assignable role place

View File

@@ -0,0 +1 @@
The emote to be used for reactions. This emote can be a default emote or an emote in a server the bot is in.

View File

@@ -0,0 +1 @@
The name of the assignable role place to add the assignable role to.

View File

@@ -0,0 +1 @@
addRoleToAssignableRolePlace <placeName> <emote> <description> <role>

View File

@@ -0,0 +1 @@
Changes the description which is shown for the assignable role place. This change takes effect the next time the assignable place is setup the next time.

View File

@@ -0,0 +1 @@
changeAssignablePlaceDescription <placeName> <newDescription>

View File

@@ -0,0 +1,6 @@
Command to change the configuration of one assignable role place.
The possible things to change are:
`inline`: Whether or not the assignable role descriptions are shown inline. Inline means they will be as close together as possible, if this is set to false, they will be shown in a colum
`autoRemove`: Whether or not the added reactions are immediately remove after the selected role has been assigned.
`unique`: Whether or not it is only possible to select one role at a time.
`active`: Whether or not the assignable role place is active. An inactive assignable role place, does not assign any roles and removes the reactions automatically.

View File

@@ -0,0 +1 @@
The configuration which should be changed, can either be `inline`, `autoRemove`, `active` or `unique`. This key is not case sensitive.

View File

@@ -0,0 +1 @@
The name of the assignable place for the configuration should be changed.

View File

@@ -0,0 +1 @@
changeAssignableRolePlaceConfig <placeName> <key> <newValue>

View File

@@ -0,0 +1,2 @@
Creates an assignable role place with the given name used as key to identify it. The provided description will be displayed when it is posted.
This does not create any messages, only creates the instance in the database and can be removed with `deleteAssignableRolePlace`.

View File

@@ -0,0 +1 @@
The channel in which the assignable role post should be posted in.

View File

@@ -0,0 +1 @@
The text which should be displayed as the description of the assignable role place.

View File

@@ -0,0 +1 @@
createAssignableRolePlace <name> <channel> <text>

View File

@@ -0,0 +1 @@
Activates an assignable role place again, meaning reacting to the reactions will not assign the configured roles and will automatically remove any added reactions.

View File

@@ -0,0 +1 @@
Deletes the assignable role place completely from the database and within discord, if there are any currently present

View File

@@ -0,0 +1 @@
This changes the text which describes the assignable role place and is shown in the the first message of the place.

View File

@@ -0,0 +1,2 @@
Moves the assignable role place to another channel.
This change only comes into effect the next time the assignable role place is setup the next time.

View File

@@ -0,0 +1 @@
moveAssignableRolePlace <placeName> <newChannel>

View File

@@ -0,0 +1 @@
Removes an assignable role from an assignable place. The place is identified by its key and the role is identified by the emote used to react to the post.

View File

@@ -0,0 +1 @@
The name of the assignable place to remove the assignable role from

View File

@@ -0,0 +1 @@
Sets the position of an emote within an assignable place

View File

@@ -0,0 +1,3 @@
Sets the position of an assignable role within an assignable place.
It is not possible to set it beyond the currently largest position and also not possible to set it to a position already taken by another assignable role.
This change will ony be in effect when the assignable role place is setup the next time.

View File

@@ -0,0 +1 @@
The emote which identifies the assignable role to change the position of

View File

@@ -0,0 +1 @@
The name of the assignable place to change the position of an assignable role in

View File

@@ -0,0 +1 @@
setAssignableRolePosition <placeName> <emote> <newPosition>

View File

@@ -0,0 +1 @@
Creates the messages containing the assignable roles in the description and the emotes as reactions

View File

@@ -0,0 +1,2 @@
Deletes the old assignable role posts (if any) and creates the assignable role posts completely anew in the channel where the assignable post is configured in.
This effectively means that old reactions are lost, but the assigned roles still persist.

View File

@@ -0,0 +1 @@
#${role.position}: ${role.emote.asMention} with <#if role.awardedRole?has_content>${role.awardedRole.asMention}<#else>Deleted role</#if>: `${role.description}`.

View File

@@ -0,0 +1,2 @@
Configuration for assignable roles for assignable role place `${place.key}`, shown with text: ${place.text}, which is currently ${place.active?string('active', 'not active')}. The fields are shown ${place.inline?string('inline', 'not inline')}.
If a role has been assigned, the added reaction will ${place.autoRemove?string('be removed', 'not be removed')} and it is ${place.uniqueRoles?string('not possible', 'possible')} to have multiple roles at once.

View File

@@ -0,0 +1 @@
Shows the current configuration of an assignable role place

View File

@@ -0,0 +1,2 @@
Shows all of the possible configurations of the given assignable role place.
This includes: the assignable roles (emote, description and awarded role), whether or not the emotes are displayed inline or directly on top of one another, whether or not the assignable role place is active

View File

@@ -0,0 +1 @@
The assignable role place to show of the configuration of

View File

@@ -0,0 +1 @@
Shows the currently available assignable role places

View File

@@ -0,0 +1 @@
Shows a list of the currently available assignable role places with their respective keys.

View File

@@ -0,0 +1 @@
Switches the embed appearance of the roles for a assignable role place to be more spread out

View File

@@ -0,0 +1,2 @@
This command can be used to show the emotes in the assignable place posts in a column, so the messages are a bit more spread out and structured.
This change applies when the assignable place is setup the next time.

View File

@@ -0,0 +1 @@
The name of the assignable place in which the emotes should be displayed spread out.

Some files were not shown because too many files have changed in this diff Show More