forked from Fascinated/Bat
update log format for messages
This commit is contained in:
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user