replaced includes with safe includes, so that the json syntax is not broken

This commit is contained in:
Sheldan
2020-08-15 19:23:21 +02:00
parent 48bc33860d
commit 8a33ff6099
74 changed files with 320 additions and 319 deletions

View File

@@ -0,0 +1 @@
<#macro safe_include template_key><#assign rendered><#include "${template_key}"></#assign>${rendered?js_string}</#macro>

View File

@@ -1,6 +1,6 @@
{
"title": {
"title": "<#include "features_embed_title">"
"title": "<@safe_include "features_embed_title"/>"
},
"color" : {
"r": 200,
@@ -9,7 +9,7 @@
},
"description": "
<#list features as feature>
${feature.featureFlag.enabled?string('✅', '❌')} **<#include "${feature.featureConfig.feature.key}_feature">** <#include "feature_embed_key">: `${feature.featureConfig.feature.key}`
${feature.featureFlag.enabled?string('✅', '❌')} **<@safe_include "${feature.featureConfig.feature.key}_feature"/>** <@safe_include "feature_embed_key"/>: `${feature.featureConfig.feature.key}`
</#list>
"
}

View File

@@ -1,51 +1,51 @@
{
"title": {
"title": "<#include "help_command_embed_title">"
"title": "<@safe_include "help_command_embed_title"/>"
},
"color" : {
"r": 200,
"g": 0,
"b": 255
},
"description": "<#include "help_command_embed_command_name">: **${command.name}**
<#include "help_command_embed_command_description">: <#if command.templated> <#include "${command.name}_description"> <#else> ${command.description} </#if>
"description": "<@safe_include "help_command_embed_command_name"/>: **${command.name?js_string}**
<@safe_include "help_command_embed_command_description"/>: <#if command.templated> <@safe_include "${command.name}_description"/> <#else> ${command.description?js_string} </#if>
<#if command.help??>
<#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">
**<@safe_include "help_command_embed_command_usage"/>**: `<@safe_include "${command.name}_usage"/>`
**<@safe_include "help_command_embed_command_detailed_help"/>**: <@safe_include "${command.name}_long_help"/>
<#if command.help.hasExample>
<#include "help_command_embed_command_example">: <#include "${command.name}_example">
<@safe_include "help_command_embed_command_example"/>: <@safe_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}
**<@safe_include "help_command_embed_command_usage"/>**: `${command.help.usage?js_string}`
**<@safe_include "help_command_embed_command_detailed_help"/>**: ${command.help.longHelp?js_string}
<#if command.help.hasExample>
<#include "help_command_embed_command_example">:${command.help.example}
<@safe_include "help_command_embed_command_example"/>:${command.help.example?js_string}
</#if>
</#if>
<#if command.aliases?? && command.aliases?size gt 0>
<#include "help_command_embed_command_aliases">: `${command.aliases?join("`, `")}`
<@safe_include "help_command_embed_command_aliases"/>: `${command.aliases?join("`, `")?js_string}`
</#if>
<#if restricted?? && restricted>
<#include "help_command_embed_command_executable_by">:<#if allowedRoles??> <#list allowedRoles as allowedRole> ${allowedRole.asMention}<#sep><#include "help_command_embed_or"><#else><#include "help_command_embed_command_executable_by_nobody"></#list> </#if>
<#if immuneRoles?? ><#include "help_command_embed_command_immune">: <#list immuneRoles as immuneRole> ${immuneRole.asMention}<#sep><#include "help_command_embed_or"><#else>None</#list> </#if>
<@safe_include "help_command_embed_command_executable_by"/>:<#if allowedRoles??> <#list allowedRoles as allowedRole> ${allowedRole.asMention?js_string}<#sep><@safe_include "help_command_embed_or"/><#else><@safe_include "help_command_embed_command_executable_by_nobody"/></#list> </#if>
<#if immuneRoles?? ><@safe_include "help_command_embed_command_immune"/>: <#list immuneRoles as immuneRole> ${immuneRole.asMention?js_string}<#sep><@safe_include "help_command_embed_or"/><#else><@safe_include "help_command_embed_command_immune_none"/></#list> </#if>
<#else>
<#include "help_command_embed_command_not_restricted">
<@safe_include "help_command_embed_command_not_restricted"/>
</#if>
</#if>
**<#include "help_command_embed_command_parameters">**:
**<@safe_include "help_command_embed_command_parameters"/>**:
<#if command.parameters??>
<#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_optional"><#sep>
<@safe_include "help_command_embed_command_description"/> `${parameter.name?js_string}`: <#if parameter.templated?? && parameter.templated><@safe_include "${command.name}_parameter_${parameter.name}"/><#else>${(parameter.description?js_string)!""}</#if>
<@safe_include "help_command_embed_command_optional"/><#sep>
<#else>
<#include "help_command_embed_command_no_parameters">
<@safe_include "help_command_embed_command_no_parameters"/>
</#list>
<#else>
<#include "help_command_embed_command_no_parameters">
<@safe_include "help_command_embed_command_no_parameters"/>
</#if>
"
}

View File

@@ -1,7 +1,7 @@
{
<#assign name>${module.moduleInterface.info.name}</#assign>
"title": {
"title": "<#include "help_module_embed_title">"
"title": "<@safe_include "help_module_embed_title"/>"
},
"color" : {
"r": 200,
@@ -9,15 +9,15 @@
"b": 255
},
"description": "
<#include "help_module_embed_module_name">: **${module.moduleInterface.info.name}**
<#include "help_module_embed_module_description">: ${module.moduleInterface.info.description}
<#include "help_module_embed_commands">:
<#list module.commands as command>`${command.configuration.name}`<#sep>, </#list>
<@safe_include "help_module_embed_module_name"/>: **${module.moduleInterface.info.name?js_string}**
<@safe_include "help_module_embed_module_description"/>: ${module.moduleInterface.info.description?js_string}
<@safe_include "help_module_embed_commands"/>:
<#list module.commands as command>`${command.configuration.name?js_string}`<#sep>, </#list>
<#if module.subModules??>
<#include "help_module_embed_sub_modules">: <#list module.subModules as module>`${module.info.name}`<#sep>, </#list>
<@safe_include "help_module_embed_sub_modules"/>: <#list module.subModules as module>`${module.info.name?js_string}`<#sep>, </#list>
</#if>
",
"footer": {
"text": "<#include "help_command_embed_hint_footer">"
"text": "<@safe_include "help_command_embed_hint_footer"/>"
}
}

View File

@@ -1,6 +1,6 @@
{
"title": {
"title": "<#include "help_modules_embed_title">"
"title": "<@safe_include "help_modules_embed_title"/>"
},
"color" : {
"r": 200,
@@ -8,12 +8,12 @@
"b": 255
},
"description": "
<#list modules as module>
<#include "help_module_embed_module_name">: **${module.info.name}**
<#include "help_module_embed_module_description">: ${module.info.description}
<#list modules as module><#assign module=module/>
<@safe_include "help_module_embed_module_name"/>: **${module.info.name?js_string}**
<@safe_include "help_module_embed_module_description"/>: ${module.info.description?js_string}
</#list>
",
"footer": {
"text": "<#include "help_modules_embed_footer_hint">"
"text": "<@safe_include "help_modules_embed_footer_hint"/>"
}
}

View File

@@ -1,6 +1,6 @@
{
"title": {
"title": "<#include "listChannelGroups_embed_title">"
"title": "<@safe_include "listChannelGroups_embed_title"/>"
},
"color" : {
"r": 200,
@@ -8,14 +8,14 @@
"b": 255
},
<#if groups?size = 0>
"description": "<#include "listChannelGroups_no_channel_group">",
"description": "<@safe_include "listChannelGroups_no_channel_group"/>",
</#if>
"fields": [
<#list groups as group>
{
"name": "${group.name}",
"name": "${group.name?js_string}",
"value": "
<#list group.channels as channel>${channel.discordChannel.asMention}<#sep>,</#list>
<#list group.channels as channel>${channel.discordChannel.asMention?js_string}<#sep>,</#list>
"
}<#sep>,
<#else>

View File

@@ -1,6 +1,6 @@
{
"title": {
"title": "<#include "posttarget_embed_title">"
"title": "<@safe_include "posttarget_embed_title"/>"
},
"color" : {
"r": 200,
@@ -8,12 +8,12 @@
"b": 255
},
"description": "
<#list postTargets as postTarget>
<#assign postTargetName>${postTarget.postTarget.name}</#assign>
<#assign channelMention><#if postTarget.channel?has_content>${postTarget.channel.asMention}<#else><#include "posttarget_no_channel"></#if></#assign>
<#include "posttarget_post_target_text">
<#list postTargets as postTarget><#assign postTarget=postTarget/>
<#assign postTargetName>${postTarget.postTarget.name?js_string}</#assign>
<#assign channelMention><#if postTarget.channel?has_content>${postTarget.channel.asMention?js_string}<#else><@safe_include "posttarget_no_channel"/></#if></#assign>
<@safe_include "posttarget_post_target_text"/>
<#else>
<#include "posttarget_no_post_targets_found">
<@safe_include "posttarget_no_post_targets_found"/>
</#list>
"
}

View File

@@ -1,5 +1,5 @@
<#list actionConfigs as actionConfig>
<#list actionConfigs as actionConfig><#assign actionConfig=actionConfig/>
<#assign param=actionConfig.templateModel>
<#include "${actionConfig.templateName}">
<@safe_include "${actionConfig.templateName}"/>
</#list>

View File

@@ -1 +1 @@
<#assign featureName><#include "${featureConfig.feature.key}_feature"></#assign><#include "setup_initial_message_display">
<#assign featureName><@safe_include "${featureConfig.feature.key}_feature"/></#assign><#include "setup_initial_message_display">

View File

@@ -1 +1 @@
<#assign postTargetKey>${param.postTargetKey}</#assign><#assign channel>${param.channel.asMention}</#assign><#include "setup_post_target_action_display">
<#assign postTargetKey>${param.postTargetKey}</#assign><#assign channel>${param.channel.asMention}</#assign><@safe_include "setup_post_target_action_display"/>

View File

@@ -1 +1 @@
<#assign currentTarget><#if currentTextChannel?has_content>${currentTextChannel.asMention}<#else><#include "setup_post_target_no_channel_set"></#if></#assign><#include "setup_posttarget_${postTargetKey}">
<#assign currentTarget><#if currentTextChannel?has_content>${currentTextChannel.asMention}<#else><@safe_include "setup_post_target_no_channel_set"/></#if></#assign><@safe_include "setup_posttarget_${postTargetKey}"/>

View File

@@ -1 +1 @@
<#assign configKey>${param.configKey}</#assign><#assign newValue>${param.newValue}</#assign><#include "setup_system_config_action_display">
<#assign configKey>${param.configKey}</#assign><#assign newValue>${param.newValue}</#assign><@safe_include "setup_system_config_action_display"/>

View File

@@ -1 +1 @@
<#assign defaultValue=defaultConfig.valueAsString><#include "setup_config_${configKey}">
<#assign defaultValue=defaultConfig.valueAsString><@safe_include "setup_config_${configKey}"/>

View File

@@ -1 +1 @@
<#assign user>${user.name}#${user.discriminator} (${user.asMention})</#assign><#include "user_joined_text">
<#assign user>${user.name}#${user.discriminator} (${user.asMention})</#assign><@safe_include "user_joined_text"/>

View File

@@ -1 +1 @@
<#assign user>${user.name}#${user.discriminator} (${user.asMention})</#assign><#include "user_left_text">
<#assign user>${user.name}#${user.discriminator} (${user.asMention})</#assign><@safe_include "user_left_text"/>

View File

@@ -1,7 +1,7 @@
{
"author": {
"name": "${user.member.effectiveName}",
"avatar": "${user.member.user.effectiveAvatarUrl}"
"name": "${user.member.effectiveName?js_string}",
"avatar": "${user.member.user.effectiveAvatarUrl?js_string}"
},
"color" : {
"r": 200,
@@ -12,8 +12,7 @@
<#if template?has_content>
<#if template.templateModel?has_content>
<#assign model=template.templateModel/>
<#assign rendered><#include "${template.templateName}"></#assign>
${rendered?js_string}
<#include "${template.templateName}"/>
</#if>
<#elseif throwable.localizedMessage?has_content>
"description": "${throwable.localizedMessage?js_string}"

View File

@@ -1 +1 @@
<#assign roles><#list allowedRoles as role>${role.name}<#sep>,<#else>None configured.</#list></#assign><#include "insufficient_role_text">
<#assign roles><#list allowedRoles as role>${role.name}<#sep>,<#else><#include "insufficient_role_none_configured"></#list></#assign><#include "insufficient_role_text">

View File

@@ -1 +1 @@
"description": "<#include "role_disabled_exception_message">"
"description": "<@safe_include "role_disabled_exception_message"/>"