update log format for messages
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 44s

This commit is contained in:
Lee 2024-07-05 21:03:56 +01:00
parent 2791d6328e
commit 0cfccc70d8

@ -58,12 +58,15 @@ public class LogFeature extends Feature {
if (content == null) { if (content == null) {
return "No content"; return "No content";
} }
if (content.length() > 512) { // More than 512 characters or is more than 4 lines
if (content.length() > 512 || content.chars().filter(ch -> ch == '\n').count() > 4) {
return "*Content too long, [click here to view]("+PasteUtils.uploadPaste(content).getUrl()+")*"; return "*Content too long, [click here to view]("+PasteUtils.uploadPaste(content).getUrl()+")*";
} }
// Less than or equal to 32 characters and no new lines
if (content.length() <= 32 && !content.contains("\n")) { if (content.length() <= 32 && !content.contains("\n")) {
return "`%s`".formatted(content); return "`%s`".formatted(content);
} }
// Everything else
return "\n```\n%s\n```".formatted(content); return "\n```\n%s\n```".formatted(content);
} }
} }