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

@@ -1,2 +0,0 @@
Changes the experience scale on this server. This will only affect messages in the future. This scales the experience *after* the calculation has been done.
So if the range is 10-25, a random experience in this range will be determined and *then* multiplied by this scale.

View File

@@ -1,3 +0,0 @@
Shows 10 members of the sever in the form of a leader board.
The information include posted messages/gained experience/current level and rank within the server.
An optional parameter is possible to chose a page. So, `leaderboard 3` would show members from rank 30 to 40.

View File

@@ -12,7 +12,7 @@
"b": 255
},
"description": "
Rank | Name | Experience | Level | Messages
<#include "leaderboard_rank_column"> | <#include "leaderboard_name_column"> | <#include "leaderboard_experience_column"> | <#include "leaderboard_level_column"> | <#include "leaderboard_messages_column">
<#list userExperiences as user>
<@userDisplay user=user />
</#list>

View File

@@ -1 +0,0 @@
Shows your messages, tracked experience, current level and the experience needed to the next level.

View File

@@ -10,27 +10,27 @@
},
"fields": [
{
"name": "XP",
"name": "<#include "rank_xp_field_title">",
"value": "${rankUser.experience.experience}",
"inline": "true"
},
{
"name": "Level",
"name": "<#include "rank_level_field_title">",
"value": "${rankUser.experience.currentLevel.level}",
"inline": "true"
},
{
"name": "Messages",
"name": "<#include "rank_messages_field_title">",
"value": "${rankUser.experience.messageCount}",
"inline": "true"
},
{
"name": "XP to next Level",
"name": "<#include "rank_to_next_level_field_title">",
"value": "${experienceToNextLevel}",
"inline": "true"
},
{
"name": "Rank",
"name": "<#include "rank_rank_field_title">",
"value": "${rankUser.rank}",
"inline": "true"
}

View File

@@ -1,2 +0,0 @@
This causes the given role to be awarded at the given level. This will remove previously levels this role was assigned to, and also recalculate the users of the previous levels.
This will not, however, award the users the new role immediately. This needs to be done by a separate `syncExpRole`.

View File

@@ -1,3 +0,0 @@
This is a process, which iterates over all tracked users and checks if the current experience role aligns with what they should have according to configuration.
If this is not the case, the role is updated. This is necessary after you added a new role to the experience system. This process might take a while to complete
and a progress indicator is shown.

View File

@@ -1,3 +1,3 @@
{
"additionalMessage": "Updating users: ${currentCount}/${totalUserCount}."
"additionalMessage": "<#include "syncExpRoles_updating_users_label">: ${currentCount}/${totalUserCount}."
}

View File

@@ -1,3 +0,0 @@
Removes the role from experience tracking, so users do not gain the role when they reach the configured level.
Executing this means that users currently owning this role, lose it and their role will be recalculated.
This process might take a while depending on the users. A progress indicator is shown

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>"
}

View File

@@ -1 +0,0 @@
Accepts the given suggestion. Will post the suggestion again, with the given reason for acceptance, with the old text strike through and 'Accepted by' as a notice.

View File

@@ -1 +0,0 @@
Rejects the given suggestion. Will post the suggestion again, with the given reason for rejection, with the old text strike through and 'Rejected by' as a notice.

View File

@@ -1,9 +0,0 @@
Reminds you in the given duration of the given text.
The reminder will also include a link to the original message.
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

@@ -8,19 +8,19 @@
"g": 0,
"b": 255
},
"description": "You wanted to be reminded.",
"description": "<#include "remind_reminder_description">",
"fields": [
{
"name": "Duration",
"name": "<#include "remind_reminder_duration_field_title">",
"value": "${fmtDuration(duration)}"
},
{
"name": "Note",
"name": "<#include "remind_reminder_note_field_title">",
"value": "${reminder.text}"
},
{
"name": "Link",
"value": "[Jump!](${messageUrl})"
"name": "<#include "remind_reminder_link_field_title">",
"value": "[<#include "remind_reminder_link_content_display_text">](${messageUrl})"
}
],
"additionalMessage": "${member.asMention}"

View File

@@ -1,4 +1,6 @@
{
<#assign id>${reminder.id}</#assign>
<#assign messageUrl>${message.jumpUrl}</#assign>
"author": {
"name": "${member.effectiveName}",
"avatar": "${member.user.effectiveAvatarUrl}"
@@ -8,6 +10,6 @@
"g": 0,
"b": 255
},
"description": "Scheduled reminder ${reminder.id} to remind you of [this](${message.jumpUrl})",
"description": "<#include "remind_reminding_description_text">",
"additionalMessage": "${member.asMention}"
}

View File

@@ -9,13 +9,14 @@
"b": 255
},
"title": {
"title": "Currently active reminders"
"title": "<#include "reminders_reminders_embed_title">"
},
"fields": [
<#list reminders as reminder>
{
"name": "Reminder ${reminder.id}",
"value": "Due on ${reminder.targetDate} with text ${reminder.text}"
<#assign id>${reminder.id}</#assign>
"name": "<#include "reminders_reminder_field_title">",
"value": "<#include "reminders_due_on">"
}
<#sep>,
</#list>

View File

@@ -1 +1 @@
**Name**: ${emote.name} **Link**: ${emote.imageUrl}
<#assign name> ${emote.name} </#assign> <#assign url> ${emote.imageUrl} </#assign>**<#include "showEmote_name">**: ${emote.name} **<#include "showEmote_link">**: ${emote.imageUrl}

View File

@@ -1,49 +1,51 @@
{
"title": {
"title": "Server starboard stats"
"title": "<#include "starStats_response_title">"
},
"color" : {
"r": 200,
"g": 0,
"b": 255
},
"description": "${starredMessages} starred messages with ${totalStars} stars in total",
"description": "<#include "startStats_description">",
"fields": [
{
"name": "Top starred posts",
"name": "<#include "starStats_top_starred_field_title">",
"value": "
<#list topPosts as post>
${badgeEmotes[post?index]} - ${post.starCount} :star: [Jump!](${post.messageUrl})
<#assign badge>${badgeEmotes[post?index]}</#assign><#assign count>${post.starCount}</assign><#assign link>${post.messageUrl}</#assign> <#include "starStats_starred_entry">
<#else>
No starred messages.
<#include "starStats_no_starred_messages">
</#list>
"
},
{
"name": "Top starrer",
"name": "<#include "starStats_top_starrer_field_title">",
"value": "
<#list starGiver as starrer>
<#assign badge>${badgeEmotes[starrer?index]}</#assign><#assign count>${starrer.starCount}</assign>
<#if starrer.member?has_content>
${badgeEmotes[starrer?index]} - ${starrer.starCount} :star: ${starrer.member.asMention}
<#assign user>${starrer.member.asMention}</#assign> <#include "starStats_starrer_entry">
<#else>
${badgeEmotes[starrer?index]} - ${starrer.starCount} :star: ${starrer.user.id?c} (Left the guild)
<#assign user>${starrer.user.id?c}</#assign> <#include "starStats_starrer_entry_left_guild_en_US.ftl">
</#if>
<#else>
No starred messages.
<#include "starStats_no_starred_messages">
</#list>
"
},
{
"name": "Top star receiver",
"name": "<#include "starStats_top_receiver_field_title">",
"value": "
<#list starReceiver as starred>
<#assign badge>${badgeEmotes[starred?index]}</#assign><#assign count>${starred.starCount}</assign>
<#if starred.member?has_content>
${badgeEmotes[starred?index]} - ${starred.starCount} :star: ${starred.member.asMention}
<#assign user>${starred.member.asMention}</#assign> <#include "starStats_receiver_entry">
<#else>
${badgeEmotes[starred?index]} - ${starred.starCount} :star: ${starred.user.id?c} (Left the guild)
<#assign user>${starred.user.id?c}</#assign> <#include "starStats_receiver_entry_left_guild">
</#if>
<#else>
No starred messages.
<#include "starStats_no_starred_messages">
</#list>
"
}

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