refactored command responses to use a central place for configuration in an extra module

fixed makeAffected role parameter
made command check name case insensitive
added name to parameter for decayAllWarnings
removed simple log from message edited listener
This commit is contained in:
Sheldan
2020-04-30 22:29:49 +02:00
parent d5482fabd4
commit 59dc8c602a
312 changed files with 284 additions and 154 deletions

View File

@@ -33,7 +33,7 @@ public class DecayAllWarnings extends AbstractConditionableCommand {
@Override
public CommandConfiguration getConfiguration() {
List<Parameter> parameters = new ArrayList<>();
Parameter logWarnings = Parameter.builder().optional(true).type(Boolean.class).build();
Parameter logWarnings = Parameter.builder().optional(true).name("writeLog").type(Boolean.class).build();
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();
parameters.add(logWarnings);
return CommandConfiguration.builder()

View File

@@ -42,8 +42,6 @@ public class MessageEditedListener implements MessageTextUpdatedListener {
.messageChannel(messageAfter.getTextChannel())
.guild(messageAfter.getGuild())
.member(messageAfter.getMember()).build();
String simpleMessageUpdatedMessage = templateService.renderTemplate(MESSAGE_EDITED_TEMPLATE, log);
postTargetService.sendTextInPostTarget(simpleMessageUpdatedMessage, EDIT_LOG_TARGET, messageAfter.getGuild().getIdLong());
MessageToSend message = templateService.renderEmbedTemplate(MESSAGE_EDITED_TEMPLATE, log);
postTargetService.sendEmbedInPostTarget(message, EDIT_LOG_TARGET, messageBefore.getServerId());
}

View File

@@ -1 +0,0 @@
User ${bannedUser.effectiveName} (${bannedUser.asMention}) has been banned with reason ${reason}.

View File

@@ -1 +0,0 @@
You were banned from the server ${serverName} for the following reason: ${warning.reason}.

View File

@@ -1 +0,0 @@
Bans the user by ID. This is necessary, if the user already left the server for example.

View File

@@ -1 +0,0 @@
Decays all warnings which are currently active on this server, and logs them to the `decayLog` post target, if the parameter was true.

View File

@@ -1 +0,0 @@
Causes the warnings older than the configured threshold in days to be decayed. They are still stored but there is an indication, that they are now longer active.

View File

@@ -1 +0,0 @@
User ${kickedUser.effectiveName} (${kickedUser.asMention}) has been kicked with reason: ${reason}.

View File

@@ -1 +0,0 @@
You were kicked from the server ${serverName} for the following reason: ${warning.reason}.

View File

@@ -4,7 +4,7 @@
"avatar": "${mutedUser.user.effectiveAvatarUrl}"
},
"title": {
"title": "User has been muted"
"title": "<#include "mute_log_title">"
},
"color" : {
"r": 200,
@@ -13,32 +13,32 @@
},
"fields": [
{
"name": "Muted User",
"name": "<#include "mute_log_muted_user_field_title">",
"value": "${mutedUser.effectiveName} ${mutedUser.asMention} (${mutedUser.idLong?c})"
},
{
"name": "Muted by",
"name": "<#include "mute_log_muting_user_field_title">",
"value": "${mutingUser.effectiveName} ${mutingUser.asMention} (${mutingUser.idLong?c})"
},
{
"name": "Location of the mute",
"name": "<#include "mute_log_mute_location_field_title">",
"value": "[${messageChannel.name}](${message.jumpUrl})"
},
{
"name": "Reason",
"name": "<#include "mute_log_mute_reason_field_title">",
"value": "${mute.reason}"
},
{
"name": "Muted for",
"name": "<#include "mute_log_mute_duration_field_title">",
"value": "${fmtDuration(muteDuration)}"
},
{
"name": "Muted until",
"name": "<#include "mute_log_muted_until_field_title">",
"value": "${formatInstant(mute.muteTargetDate, "yyyy-MM-dd HH:mm:ss")}"
}
],
"footer": {
"text": "Mute #${mute.id}"
"text": "<#include "mute_log_mute_id_footer"> #${mute.id}"
},
"timeStamp": "${mute.muteDate}"
}

View File

@@ -1,10 +0,0 @@
Applies the muted role to the user and logs the mute in the `mutes` post target.
The user will be automatically un muted after the time period is over and another un mute notification will be send to the
`mutes` post target.
The syntax for duration is the following:
s - seconds
m - minutes
h - hours
d - days
They must be positive and do no spaces between for example `1h23m` is one hour and twenty three minutes.

View File

@@ -1 +0,0 @@
You were muted on the server ${serverName} for the following reason: ${mute.reason}.

View File

@@ -6,7 +6,7 @@
},
</#if>
"title": {
"title": "User has been unmuted"
"title": "<#include "unMute_log_title">"
},
"color" : {
"r": 200,
@@ -15,41 +15,41 @@
},
"fields": [
{
"name": "Unmuted User",
"name": "<#include "unMute_log_unmuted_user_field_title">",
<#if unMutedUser?has_content>
"value": "${unMutedUser.effectiveName} ${unMutedUser.asMention} (${unMutedUser.idLong?c})"
<#else>
"value": "User has left the server (${mute.mutedUser.userReference.id?c})"
"value": "<#include "user_left_server"> (${mute.mutedUser.userReference.id?c})"
</#if>
},
{
"name": "Muted by",
"name": "<#include "mute_log_muting_user_field_title">",
<#if mutingUser?has_content>
"value": "${mutingUser.effectiveName} ${mutingUser.asMention} (${mutingUser.idLong?c})"
<#else>
"value": "User has left the server (${mute.mutingUser.userReference.id?c})"
"value": "<#include "user_left_server"> (${mute.mutingUser.userReference.id?c})"
</#if>
},
{
"name": "Location of the mute",
"name": "<#include "mute_log_mute_location_field_title">",
"value": "[Link](${messageUrl})"
},
{
"name": "Muted since",
"name": "<#include "unMute_log_muted_since_field_title">",
"value": "${formatInstant(mute.muteDate, "yyyy-MM-dd HH:mm:ss")}"
},
{
"name": "Muted for",
"name": "<#include "mute_log_mute_duration_field_title">",
"value": "${fmtDuration(muteDuration)}"
},
{
"name": "Reason",
"name": "<#include "mute_log_mute_reason_field_title">",
"value": "${mute.reason}"
}
],
"footer": {
"text": "Mute #${mute.id}"
"text": "<#include "mute_log_mute_id_footer"> #${mute.id}"
},
"timeStamp": "${unmuteDate}"
}

View File

@@ -1,2 +0,0 @@
Sets the used mute role on the server. If there are previously roles assigned, this will be overwritten.
The configuration to make the role muting, needs to be done by you.

View File

@@ -1 +0,0 @@
Sets the slow mode of the the current (or given channel) to the given duration.

View File

@@ -1,8 +0,0 @@
Sets the slow mode of the the current (or given channel) to the given interval.
The syntax for interval is the following:
s - seconds
m - minutes
h - hours
d - days
They must be positive and do no spaces between for example `1h23m` is one hour and twenty three minutes.

View File

@@ -1 +0,0 @@
Un-mutes the user. This does not send a notification in the `mutes` post target. Also removes any mutes towards the user on this server.

View File

@@ -4,7 +4,7 @@
"avatar": "${warnedUser.user.effectiveAvatarUrl}"
},
"title": {
"title": "User has been warned"
"title": "<#include "warn_log_title">"
},
"color" : {
"r": 200,
@@ -13,29 +13,29 @@
},
"fields": [
{
"name": "Warned User",
"name": "<#include "warn_log_warned_user_field_title">",
"value": "${warnedUser.effectiveName} ${warnedUser.asMention} (${warnedUser.idLong?c})"
},
<#if warningUser?has_content>
{
"name": "Warned by",
"name": "<#include "warn_log_warning_user_field_title">",
"value": "${warningUser.effectiveName} ${warningUser.asMention} (${warningUser.idLong?c})"
},
</#if>
<#if warning?has_content>
{
"name": "Location of the incident",
"name": "<#include "warn_log_warn_location_field_title">",
"value": "[${messageChannel.name}](${message.jumpUrl})"
},
</#if>
{
"name": "Reason",
"name": "<#include "warn_log_warn_reason_field_title">",
"value": "${reason}"
}
],
"footer": {
<#if warningUser?has_content>
"text": "Warning #${warning.id}"
"text": "<#include "warn_log_warn_id_footer"> #${warning.id}"
</#if>
}
}

View File

@@ -1 +0,0 @@
You were warned on the server ${serverName} for the following reason: ${warning.reason}.

View File

@@ -2,11 +2,11 @@
"imageUrl": "${imageUrl}",
"fields": [
{
"name": "Direct Url",
"value": "[Link](${imageUrl})"
"name": "<#include "messageDeleted_attachment_link_field_title">",
"value": "[<#include "messageDeleted_attachment_link_display_text">](${imageUrl})"
}
],
"footer": {
"text": "Attachment #${counter}"
"text": "<#include "messageDeleted_attachment_footer"> #${counter}"
}
}

View File

@@ -3,7 +3,7 @@
"name": "${member.effectiveName}#${member.user.discriminator}",
"avatar": "${member.user.effectiveAvatarUrl}"
},
"description": "Message from ${member.effectiveName}#${member.user.discriminator} (${member.idLong?c}) removed in ${messageChannel.asMention}",
"description": "<#include "messageDeleted_description_text">",
"color" : {
"r": 200,
"g": 0,
@@ -11,11 +11,11 @@
},
"fields": [
{
"name": ":x: Original Message: ",
"name": "<#include "messageDeleted_original_message_field_title">",
"value": "${message.content}"
},
{
"name": "Link",
"name": "<#include "messageDeleted_message_link_field_title">",
"value": "[${messageChannel.name}](${message.messageUrl})"
}
]

View File

@@ -1,2 +0,0 @@
Message from ${member.effectiveName} (${member.idLong?c}) deleted in ${messageChannel.asMention}.
Message: ${message.content}

View File

@@ -3,7 +3,7 @@
"name": "${member.effectiveName}#${member.user.discriminator}",
"avatar": "${member.user.effectiveAvatarUrl}"
},
"description": "Message from ${member.effectiveName}#${member.user.discriminator} (${member.idLong?c}) edited in ${messageChannel.asMention}",
"description": "<#include "messageEdited_description_text">",
"color" : {
"r": 200,
"g": 0,
@@ -11,15 +11,15 @@
},
"fields": [
{
"name": "Original Message: ",
"name": "<#include "messageEdited_original_message_field_title">",
"value": "${messageBefore.content}"
},
{
"name": "New Message: ",
"name": "<#include "messageEdited_new_message_field_title">",
"value": "${messageAfter.contentRaw}"
},
{
"name": "Jump link",
"name": "<#include "messageEdited_link_field_title">",
"value": "[${messageChannel.name}](${messageBefore.messageUrl})"
}
]

View File

@@ -1,3 +0,0 @@
Message from ${member.effectiveName} (${member.idLong?c}) edited in ${messageChannel.asMention}.
Before: ${messageBefore.content}
After: ${messageAfter.contentRaw}

View File

@@ -8,10 +8,8 @@
"b": 255
},
"description": "<#list warnings as warning>
<#if warning.warnedMember??>${warning.warnedMember.asMention} (${warning.warnedMember.id})<#else>${warning.warning.warnedUser.userReference.id?c}</#if> was warned on ${formatInstant(warning.warning.warnDate, "yyyy-MM-dd HH:mm:ss")}
with reason `${warning.warning.reason}` by <#if warning.warningMember??>${warning.warningMember.asMention} (${warning.warningMember.id})<#else>${warning.warning.warningUser.userReference.id?c}</#if>
<#if warning.warnedMember??><#assign warnedUser>${warning.warnedMember.asMention} (${warning.warnedMember.id})</#assign><#else><#assign warnedUser> ${warning.warning.warnedUser.userReference.id?c}</#assign></#if> <#if warning.warningMember??><#assign warningUser> ${warning.warningMember.asMention} (${warning.warningMember.id})</#assign><#else><#assign warningUser>${warning.warning.warningUser.userReference.id?c}</#assign></#if> <#include "warnDecay_log_warn_entry">
<#else>
No warnings to decay.
<#include "warnDecay_log_no_warnings">
</#list>"
}