diff --git a/core/src/main/java/sciwhiz12/janitor/messages/json/DeserializerUtil.java b/core/src/main/java/sciwhiz12/janitor/messages/json/DeserializerUtil.java deleted file mode 100644 index bb5d178..0000000 --- a/core/src/main/java/sciwhiz12/janitor/messages/json/DeserializerUtil.java +++ /dev/null @@ -1,31 +0,0 @@ -package sciwhiz12.janitor.messages.json; - -import com.fasterxml.jackson.databind.JsonNode; - -import java.util.stream.StreamSupport; -import javax.annotation.Nullable; - -import static java.util.stream.Collectors.joining; - -public final class DeserializerUtil { - public static final String NEWLINE = "\n"; - - private DeserializerUtil() {} - - @Nullable - public static String readText(JsonNode node) { - if (node.isTextual() || node.isValueNode()) { - return node.asText(); - } else if (node.isArray()) { - return StreamSupport.stream(node.spliterator(), false) - .map(JsonNode::asText) - .collect(joining(NEWLINE)); - } else if (node.isObject()) { - final String joiner = node.path("joiner").asText(NEWLINE); - return StreamSupport.stream(node.path("text").spliterator(), false) - .map(JsonNode::asText) - .collect(joining(NEWLINE)); - } - return null; - } -} diff --git a/core/src/main/java/sciwhiz12/janitor/messages/json/ListingMessageDeserializer.java b/core/src/main/java/sciwhiz12/janitor/messages/json/ListingMessageDeserializer.java index 88dac31..61c3399 100644 --- a/core/src/main/java/sciwhiz12/janitor/messages/json/ListingMessageDeserializer.java +++ b/core/src/main/java/sciwhiz12/janitor/messages/json/ListingMessageDeserializer.java @@ -4,20 +4,19 @@ import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.deser.std.StdDeserializer; -import com.google.common.base.Joiner; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.MessageEmbed; import sciwhiz12.janitor.api.messages.ListingMessage; +import sciwhiz12.janitor.utils.DeserializerUtil; import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; import java.util.List; -import javax.annotation.Nullable; + +import static java.util.Objects.requireNonNullElse; +import static sciwhiz12.janitor.utils.DeserializerUtil.readFields; +import static sciwhiz12.janitor.utils.DeserializerUtil.readText; public class ListingMessageDeserializer extends StdDeserializer { - public static final Joiner NEWLINE = Joiner.on('\n'); - public ListingMessageDeserializer() { super(ListingMessage.class); } @@ -30,7 +29,7 @@ public class ListingMessageDeserializer extends StdDeserializer String title = null; String url = null; - String description = DeserializerUtil.readText(root.path("description")); + String description = readText(root.path("description")); String color = root.path("color").asText(null); String authorName = null; String authorUrl = null; @@ -88,34 +87,8 @@ public class ListingMessageDeserializer extends StdDeserializer case "description": { return new ListingMessage.DescriptionEntry( root.path("joiner").asText(null), - root.path("text").asText()); + requireNonNullElse(DeserializerUtil.readText(root.path("text")), "")); } } } - - public static List readFields(JsonNode node) { - if (node.isArray()) { - final ArrayList fields = new ArrayList<>(); - for (int i = 0; i < node.size(); i++) { - final MessageEmbed.Field field = readField(node.path(i)); - if (field != null) { - fields.add(field); - } - } - return fields; - } - return Collections.emptyList(); - } - - @Nullable - public static MessageEmbed.Field readField(JsonNode fieldNode) { - if (fieldNode.path("name").isTextual()) { - return new MessageEmbed.Field( - fieldNode.path("name").asText(), - DeserializerUtil.readText(fieldNode.path("value")), - fieldNode.path("inline").asBoolean(false) - ); - } - return null; - } } diff --git a/core/src/main/java/sciwhiz12/janitor/messages/json/RegularMessageDeserializer.java b/core/src/main/java/sciwhiz12/janitor/messages/json/RegularMessageDeserializer.java index 359dfb2..0deb02c 100644 --- a/core/src/main/java/sciwhiz12/janitor/messages/json/RegularMessageDeserializer.java +++ b/core/src/main/java/sciwhiz12/janitor/messages/json/RegularMessageDeserializer.java @@ -4,19 +4,14 @@ import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.deser.std.StdDeserializer; -import com.google.common.base.Joiner; import net.dv8tion.jda.api.entities.MessageEmbed; import sciwhiz12.janitor.api.messages.RegularMessage; +import sciwhiz12.janitor.utils.DeserializerUtil; import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; import java.util.List; -import javax.annotation.Nullable; public class RegularMessageDeserializer extends StdDeserializer { - public static final Joiner NEWLINE = Joiner.on('\n'); - public RegularMessageDeserializer() { super(RegularMessage.class); } @@ -38,7 +33,7 @@ public class RegularMessageDeserializer extends StdDeserializer String footerIconUrl = null; String imageUrl = node.path("image").asText(null); String thumbnailUrl = node.path("thumbnail").asText(null); - List fields = readFields(node); + List fields = DeserializerUtil.readFields(node.path("fields")); // Title if (node.path("title").isTextual()) { @@ -68,30 +63,4 @@ public class RegularMessageDeserializer extends StdDeserializer return new RegularMessage(title, url, description, color, authorName, authorUrl, authorIconUrl, footerText, footerIconUrl, imageUrl, thumbnailUrl, fields); } - - public static List readFields(JsonNode node) { - if (node.path("fields").isArray()) { - final ArrayList fields = new ArrayList<>(); - for (int i = 0; i < node.path("fields").size(); i++) { - final MessageEmbed.Field field = readField(node.path("fields").path(i)); - if (field != null) { - fields.add(field); - } - } - return fields; - } - return Collections.emptyList(); - } - - @Nullable - public static MessageEmbed.Field readField(JsonNode fieldNode) { - if (fieldNode.path("name").isTextual()) { - return new MessageEmbed.Field( - fieldNode.path("name").asText(), - DeserializerUtil.readText(fieldNode.path("value")), - fieldNode.path("inline").asBoolean(false) - ); - } - return null; - } } diff --git a/core/src/main/java/sciwhiz12/janitor/utils/DeserializerUtil.java b/core/src/main/java/sciwhiz12/janitor/utils/DeserializerUtil.java new file mode 100644 index 0000000..ed4f7ba --- /dev/null +++ b/core/src/main/java/sciwhiz12/janitor/utils/DeserializerUtil.java @@ -0,0 +1,69 @@ +package sciwhiz12.janitor.utils; + +import com.fasterxml.jackson.databind.JsonNode; +import net.dv8tion.jda.api.entities.MessageEmbed; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.stream.StreamSupport; +import javax.annotation.Nullable; + +import static java.util.stream.Collectors.joining; +import static net.dv8tion.jda.api.EmbedBuilder.ZERO_WIDTH_SPACE; + +public final class DeserializerUtil { + public static final String NEWLINE = "\n"; + + private DeserializerUtil() {} + + @Nullable + public static String readText(JsonNode node) { + if (node.isTextual() || node.isValueNode()) { + return node.asText(); + } else if (node.isArray()) { + return StreamSupport.stream(node.spliterator(), false) + .map(JsonNode::asText) + .collect(joining(NEWLINE)); + } else if (node.isObject()) { + final String joiner = node.path("joiner").asText(NEWLINE); + return StreamSupport.stream(node.path("text").spliterator(), false) + .map(JsonNode::asText) + .collect(joining(NEWLINE)); + } + return null; + } + + public static List readFields(JsonNode root) { + List fields = new ArrayList<>(); + + if (root.isArray()) { + for (JsonNode node : root) { + if (node.isNull()) { + fields.add(new MessageEmbed.Field(ZERO_WIDTH_SPACE, ZERO_WIDTH_SPACE, false)); + } else if (node.isObject()) { + fields.add(new MessageEmbed.Field( + node.path("name").asText(ZERO_WIDTH_SPACE), + node.path("value").asText(ZERO_WIDTH_SPACE), + node.path("inline").asBoolean(true) + )); + } + } + } else if (root.isObject()) { + for (Iterator names = root.fieldNames(); names.hasNext(); ) { + final String name = names.next(); + final JsonNode node = root.get(name); + final String fieldName = node.path("name").asText(name); + String value = ZERO_WIDTH_SPACE; + if (node.isValueNode()) { + value = node.asText(); + } + final String fieldValue = node.path("value").asText(value); + final boolean inline = node.path("inline").asBoolean(true); + fields.add(new MessageEmbed.Field(fieldName, fieldValue, inline)); + } + } + + return fields; + } +} diff --git a/core/src/main/resources/messages/general/about.json b/core/src/main/resources/messages/general/about.json index 5e4df7e..a8c14c0 100644 --- a/core/src/main/resources/messages/general/about.json +++ b/core/src/main/resources/messages/general/about.json @@ -6,11 +6,7 @@ "_Use `${guild.command_prefix}commands` to get the list of enabled commands in this guild._", "\nRunning **${bot.name}**, version **${bot.version}**. Serving **${bot.guild_count}** guilds." ], - "fields": [ - { - "name": "Active Modules (${bot.modules.count})", - "value": "${bot.modules.names}", - "inline": true - } - ] + "fields": { + "Active Modules (${bot.modules.count})": "${bot.modules.names}" + } } \ No newline at end of file diff --git a/core/src/main/resources/messages/general/error/cannot_interact.json b/core/src/main/resources/messages/general/error/cannot_interact.json index 4f89e26..0e357a0 100644 --- a/core/src/main/resources/messages/general/error/cannot_interact.json +++ b/core/src/main/resources/messages/general/error/cannot_interact.json @@ -1,11 +1,7 @@ { "color": "${general.error.color}", "description": "Cannot perform action on the given member, likely due to me being lower in the role hierarchy.", - "fields": [ - { - "name": "Target", - "value": "${target.mention}", - "inline": true - } - ] + "fields": { + "Target": "${target.mention}" + } } \ No newline at end of file diff --git a/core/src/main/resources/messages/general/error/insufficient_permissions.json b/core/src/main/resources/messages/general/error/insufficient_permissions.json index 4d3dd72..10a879a 100644 --- a/core/src/main/resources/messages/general/error/insufficient_permissions.json +++ b/core/src/main/resources/messages/general/error/insufficient_permissions.json @@ -4,11 +4,7 @@ "I do not have sufficient permissions to carry out this action.", "Please contact your server administrators if you believe this is in error." ], - "fields": [ - { - "name": "Required permissions", - "value": "${required_permissions}", - "inline": true - } - ] + "fields": { + "Required permissions": "${required_permissions}" + } } \ No newline at end of file diff --git a/moderation/src/main/resources/messages/moderation/ban/dm.json b/moderation/src/main/resources/messages/moderation/ban/dm.json index 6f83c61..1e52117 100644 --- a/moderation/src/main/resources/messages/moderation/ban/dm.json +++ b/moderation/src/main/resources/messages/moderation/ban/dm.json @@ -5,16 +5,8 @@ "icon_url": "${performer.guild.icon_url}" }, "title": "You were banned from this server.", - "fields": [ - { - "name": "Moderator", - "value": "${performer.mention}", - "inline": true - }, - { - "name": "Reason", - "value": "${nullcheck;reason;_No reason specified._}", - "inline": true - } - ] + "fields": { + "Moderator": "${performer.mention}", + "Reason": "${nullcheck;reason;_No reason specified_}" + } } \ No newline at end of file diff --git a/moderation/src/main/resources/messages/moderation/ban/info.json b/moderation/src/main/resources/messages/moderation/ban/info.json index 5cccc64..b2c7d12 100644 --- a/moderation/src/main/resources/messages/moderation/ban/info.json +++ b/moderation/src/main/resources/messages/moderation/ban/info.json @@ -4,31 +4,14 @@ "name": "Banned user from server.", "icon_url": "${moderation.icon_url}" }, - "fields": [ - { - "name": "Performer", - "value": "${performer.mention}", - "inline": true - }, - { - "name": "Target", - "value": "${target.mention}", - "inline": true - }, - { - "name": "Sent DM", - "value": "${private_message}", - "inline": true - }, - { - "name": "Message Deletion", - "value": "${delete_duration} day(s)", - "inline": true - }, - { - "name": "Reason", + "fields": { + "Performer": "${performer.mention}", + "Target": "${target.mention}", + "Sent DM": "${private_message}", + "Message Deletion": "${delete_duration} day(s)", + "Reason": { "value": "${nullcheck;reason;_No reason specified._}", "inline": false } - ] + } } \ No newline at end of file diff --git a/moderation/src/main/resources/messages/moderation/error/cannot_interact.json b/moderation/src/main/resources/messages/moderation/error/cannot_interact.json index daab16a..fcc9a96 100644 --- a/moderation/src/main/resources/messages/moderation/error/cannot_interact.json +++ b/moderation/src/main/resources/messages/moderation/error/cannot_interact.json @@ -1,11 +1,7 @@ { "color": "${general.error.color}", "description": "The performer of this command cannot moderate the target user, likely due to being lower in the role hierarchy.", - "fields": [ - { - "name": "Target", - "value": "${target.mention}", - "inline": true - } - ] + "fields": { + "Target": "${target.mention}" + } } \ No newline at end of file diff --git a/moderation/src/main/resources/messages/moderation/error/insufficient_permissions.json b/moderation/src/main/resources/messages/moderation/error/insufficient_permissions.json index e2044bd..8c33909 100644 --- a/moderation/src/main/resources/messages/moderation/error/insufficient_permissions.json +++ b/moderation/src/main/resources/messages/moderation/error/insufficient_permissions.json @@ -1,11 +1,7 @@ { "color": "${general.error.color}", "description": "The performer of this command has insufficient permissions to use this command.", - "fields": [ - { - "name": "Required permissions", - "value": "${required_permissions}", - "inline": true - } - ] + "fields": { + "Required permissions": "${required_permissions}" + } } \ No newline at end of file diff --git a/moderation/src/main/resources/messages/moderation/error/note/max_amount_of_notes.json b/moderation/src/main/resources/messages/moderation/error/note/max_amount_of_notes.json index 5ac9daf..3581fd9 100644 --- a/moderation/src/main/resources/messages/moderation/error/note/max_amount_of_notes.json +++ b/moderation/src/main/resources/messages/moderation/error/note/max_amount_of_notes.json @@ -1,16 +1,8 @@ { "color": "${general.error.color}", "description": "The performer has reached the maximum amount of notes for the target user.", - "fields": [ - { - "name": "Target", - "value": "${target.mention}", - "inline": true - }, - { - "name": "(Max.) Amount", - "value": "${notes_amount}", - "inline": true - } - ] + "fields": { + "Target": "${target.mention}", + "(Max.) Amount": "${notes_amount}" + } } \ No newline at end of file diff --git a/moderation/src/main/resources/messages/moderation/error/unwarn/cannot_remove_higher_mod.json b/moderation/src/main/resources/messages/moderation/error/unwarn/cannot_remove_higher_mod.json index 631305a..b7139a6 100644 --- a/moderation/src/main/resources/messages/moderation/error/unwarn/cannot_remove_higher_mod.json +++ b/moderation/src/main/resources/messages/moderation/error/unwarn/cannot_remove_higher_mod.json @@ -1,16 +1,8 @@ { "color": "${general.error.color}", "title": "Cannot remove warning issued by higher-ranked moderator.", - "fields": [ - { - "name": "Performer", - "value": "${performer.mention}", - "inline": true - }, - { - "name": "Issuer", - "value": "${warning_entry.performer.mention}", - "inline": true - } - ] + "fields": { + "Performer": "${performer.mention}", + "Issuer": "${warning_entry.performer.mention}" + } } \ No newline at end of file diff --git a/moderation/src/main/resources/messages/moderation/error/unwarn/cannot_unwarn_self.json b/moderation/src/main/resources/messages/moderation/error/unwarn/cannot_unwarn_self.json index 26cfad0..75c0853 100644 --- a/moderation/src/main/resources/messages/moderation/error/unwarn/cannot_unwarn_self.json +++ b/moderation/src/main/resources/messages/moderation/error/unwarn/cannot_unwarn_self.json @@ -1,16 +1,8 @@ { "color": "${general.error.color}", "title": "Cannot remove warning from self.", - "fields": [ - { - "name": "Performer/Target", - "value": "${performer.mention}", - "inline": true - }, - { - "name": "Issuer", - "value": "${warning_entry.performer.mention}", - "inline": true - } - ] + "fields": { + "Performer/Target": "${performer.mention}", + "Issuer": "${warning_entry.performer.mention}" + } } \ No newline at end of file diff --git a/moderation/src/main/resources/messages/moderation/error/warn/cannot_warn_mods.json b/moderation/src/main/resources/messages/moderation/error/warn/cannot_warn_mods.json index aa93be5..8fb2be3 100644 --- a/moderation/src/main/resources/messages/moderation/error/warn/cannot_warn_mods.json +++ b/moderation/src/main/resources/messages/moderation/error/warn/cannot_warn_mods.json @@ -1,11 +1,7 @@ { "color": "${general.error.color}", "title": "Cannot warn other moderators.", - "fields": [ - { - "name": "Target", - "value": "${target.mention}", - "inline": true - } - ] + "fields": { + "Target": "${target.mention}" + } } \ No newline at end of file diff --git a/moderation/src/main/resources/messages/moderation/kick/dm.json b/moderation/src/main/resources/messages/moderation/kick/dm.json index 9f5fe51..fb1ddc1 100644 --- a/moderation/src/main/resources/messages/moderation/kick/dm.json +++ b/moderation/src/main/resources/messages/moderation/kick/dm.json @@ -5,16 +5,8 @@ "icon_url": "${performer.guild.icon_url}" }, "title": "You were kicked from this server.", - "fields": [ - { - "name": "Moderator", - "value": "${performer.mention}", - "inline": true - }, - { - "name": "Reason", - "value": "${nullcheck;reason;_No reason specified._}", - "inline": true - } - ] + "fields": { + "Moderator": "${performer.mention}", + "Reason": "${nullcheck;reason;_No reason specified._}" + } } \ No newline at end of file diff --git a/moderation/src/main/resources/messages/moderation/kick/info.json b/moderation/src/main/resources/messages/moderation/kick/info.json index 27de619..ee1eb7b 100644 --- a/moderation/src/main/resources/messages/moderation/kick/info.json +++ b/moderation/src/main/resources/messages/moderation/kick/info.json @@ -4,26 +4,13 @@ "name": "Kicked user from server.", "icon_url": "${moderation.icon_url}" }, - "fields": [ - { - "name": "Performer", - "value": "${performer.mention}", - "inline": true - }, - { - "name": "Target", - "value": "${target.mention}", - "inline": true - }, - { - "name": "Sent DM", - "value": "${private_message}", - "inline": true - }, - { - "name": "Reason", + "fields": { + "Performer": "${performer.mention}", + "Target": "${target.mention}", + "Sent DM": "${private_message}", + "Reason": { "value": "${nullcheck;reason;_No reason specified._}", "inline": false } - ] + } } \ No newline at end of file diff --git a/moderation/src/main/resources/messages/moderation/note/add.json b/moderation/src/main/resources/messages/moderation/note/add.json index bcbaf82..23fbc64 100644 --- a/moderation/src/main/resources/messages/moderation/note/add.json +++ b/moderation/src/main/resources/messages/moderation/note/add.json @@ -4,31 +4,14 @@ "name": "Recorded note for user.", "icon_url": "${moderation.icon_url}" }, - "fields": [ - { - "name": "Performer", - "value": "${note_entry.performer.mention}", - "inline": true - }, - { - "name": "Target", - "value": "${note_entry.target.mention}", - "inline": true - }, - { - "name": "Note ID", - "value": "${note_entry.note_id}", - "inline": true - }, - { - "name": "Date & Time", - "value": "${note_entry.date_time}", - "inline": true - }, - { - "name": "Text", + "fields": { + "Performer": "${note_entry.performer.mention}" + "Target": "${note_entry.target.mention}" + "Note ID": "${note_entry.note_id}" + "Date & Time": "${note_entry.date_time}", + "Text": { "value": "${note_entry.contents}", "inline": false } - ] + } } \ No newline at end of file diff --git a/moderation/src/main/resources/messages/moderation/note/list.json b/moderation/src/main/resources/messages/moderation/note/list.json index 7aa2946..778c9ec 100644 --- a/moderation/src/main/resources/messages/moderation/note/list.json +++ b/moderation/src/main/resources/messages/moderation/note/list.json @@ -7,7 +7,11 @@ }, "entry": { "type": "description", - "text": "**#${note_entry.note_id}**: ${note_entry.target.mention} by ${note_entry.performer.mention}\n - _${note_entry.date_time}_\n${note_entry.contents}" + "text": [ + "**#${note_entry.note_id}**: ${note_entry.target.mention} by ${note_entry.performer.mention}", + " - _${note_entry.date_time}_", + "${note_entry.contents}" + ] }, "empty": "**_No recorded notes matching your query._**" } \ No newline at end of file diff --git a/moderation/src/main/resources/messages/moderation/note/remove.json b/moderation/src/main/resources/messages/moderation/note/remove.json index 3733dd0..a966a2c 100644 --- a/moderation/src/main/resources/messages/moderation/note/remove.json +++ b/moderation/src/main/resources/messages/moderation/note/remove.json @@ -4,36 +4,15 @@ "name": "Removed note.", "icon_url": "${moderation.icon_url}" }, - "fields": [ - { - "name": "Performer", - "value": "${performer.mention}", - "inline": true - }, - { - "name": "Original Performer", - "value": "${note_entry.performer.mention}", - "inline": true - }, - { - "name": "Original Target", - "value": "${note_entry.target.mention}", - "inline": true - }, - { - "name": "Note ID", - "value": "${note_entry.note_id}", - "inline": true - }, - { - "name": "Date & Time", - "value": "${note_entry.date_time}", - "inline": true - }, - { - "name": "Text", + "fields": { + "Performer": "${performer.mention}", + "Original Performer": "${note_entry.performer.mention}", + "Original Target": "${note_entry.target.mention}", + "Note ID": "${note_entry.note_id}", + "Date & Time": "${note_entry.date_time}", + "Text": { "value": "${note_entry.contents}", "inline": false } - ] + } } \ No newline at end of file diff --git a/moderation/src/main/resources/messages/moderation/unban/info.json b/moderation/src/main/resources/messages/moderation/unban/info.json index aa0ecf0..e220cdf 100644 --- a/moderation/src/main/resources/messages/moderation/unban/info.json +++ b/moderation/src/main/resources/messages/moderation/unban/info.json @@ -4,16 +4,8 @@ "name": "Unbanned user from server.", "icon_url": "${moderation.icon_url}" }, - "fields": [ - { - "name": "Performer", - "value": "${performer.mention}", - "inline": true - }, - { - "name": "Target", - "value": "${target.mention}", - "inline": true - } - ] + "fields": { + "Performer": "${performer.mention}", + "Target": "${target.mention}" + } } \ No newline at end of file diff --git a/moderation/src/main/resources/messages/moderation/unwarn/info.json b/moderation/src/main/resources/messages/moderation/unwarn/info.json index 6b6efa5..be6c9e7 100644 --- a/moderation/src/main/resources/messages/moderation/unwarn/info.json +++ b/moderation/src/main/resources/messages/moderation/unwarn/info.json @@ -4,36 +4,15 @@ "name": "Removed warning from user.", "icon_url": "${moderation.icon_url}" }, - "fields": [ - { - "name": "Performer", - "value": "${performer.mention}", - "inline": true - }, - { - "name": "Original Target", - "value": "${warning_entry.target.mention}", - "inline": true - }, - { - "name": "Original Performer", - "value": "${warning_entry.performer.mention}", - "inline": true - }, - { - "name": "Case ID", - "value": "${warning_entry.case_id}", - "inline": true - }, - { - "name": "Date & Time", - "value": "${warning_entry.date_time}", - "inline": true - }, - { - "name": "Reason", + "fields": { + "Performer": "${performer.mention}", + "Original Target": "${warning_entry.target.mention}", + "Original Performer": "${warning_entry.performer.mention}", + "Case ID": "${warning_entry.case_id}", + "Date & Time": "${warning_entry.date_time}", + "Reason": { "value": "${nullcheck;warning_entry.reason;_No reason specified._}", "inline": false } - ] + } } \ No newline at end of file diff --git a/moderation/src/main/resources/messages/moderation/warn/dm.json b/moderation/src/main/resources/messages/moderation/warn/dm.json index 511d01b..1f9225a 100644 --- a/moderation/src/main/resources/messages/moderation/warn/dm.json +++ b/moderation/src/main/resources/messages/moderation/warn/dm.json @@ -5,21 +5,12 @@ "icon_url": "${performer.guild.icon_url}" }, "title": "You were warned by a moderator.", - "fields": [ - { - "name": "Moderator", - "value": "${warning_entry.performer.mention}", - "inline": true - }, - { - "name": "Date & Time", - "value": "${warning_entry.date_time}", - "inline": true - }, - { - "name": "Reason", + "fields": { + "Moderator": "${warning_entry.performer.mention}", + "Date & Time": "${warning_entry.date_time}", + "Reason": { "value": "${nullcheck;warning_entry.reason;_No reason specified._}", "inline": false } - ] + } } \ No newline at end of file diff --git a/moderation/src/main/resources/messages/moderation/warn/info.json b/moderation/src/main/resources/messages/moderation/warn/info.json index c7bbec6..177f6a7 100644 --- a/moderation/src/main/resources/messages/moderation/warn/info.json +++ b/moderation/src/main/resources/messages/moderation/warn/info.json @@ -4,36 +4,15 @@ "name": "Warned user.", "icon_url": "${moderation.icon_url}" }, - "fields": [ - { - "name": "Performer", - "value": "${warning_entry.performer.mention}", - "inline": true - }, - { - "name": "Target", - "value": "${warning_entry.target.mention}", - "inline": true - }, - { - "name": "Case ID", - "value": "${warning_entry.case_id}", - "inline": true - }, - { - "name": "Sent DM", - "value": "${private_message}", - "inline": true - }, - { - "name": "Date & Time", - "value": "${warning_entry.date_time}", - "inline": true - }, - { - "name": "Reason", + "fields": { + "Performer": "${warning_entry.performer.mention}", + "Target": "${warning_entry.target.mention}", + "Case ID": "${warning_entry.case_id}", + "Sent DM": "${private_message}", + "Date & Time": "${warning_entry.date_time}", + "Reason": { "value": "${nullcheck;warning_entry.reason;_No reason specified._}", "inline": false } - ] + } } \ No newline at end of file diff --git a/moderation/src/main/resources/messages/moderation/warn/list.json b/moderation/src/main/resources/messages/moderation/warn/list.json index 3a2b7a3..3af8eed 100644 --- a/moderation/src/main/resources/messages/moderation/warn/list.json +++ b/moderation/src/main/resources/messages/moderation/warn/list.json @@ -7,7 +7,11 @@ }, "entry": { "type": "description", - "text": "**Case #${warning_entry.case_id}**: Warned ${warning_entry.target.mention} by ${warning_entry.performer.mention} \n - _Date & Time:_ ${warning_entry.date_time} \n - _Reason:_ ${warning_entry.reason}" + "text": [ + "**Case #${warning_entry.case_id}**: Warned ${warning_entry.target.mention} by ${warning_entry.performer.mention}", + " - _Date & Time:_ ${warning_entry.date_time}", + " - _Reason:_ ${warning_entry.reason}" + ] }, "empty": "**_No warnings logged matching your query._**" } \ No newline at end of file