return more user-friendly message for debug memory-stats

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-05-01 21:45:30 -04:00 committed by June
parent a7f8c848aa
commit 0f13ada300
1 changed files with 10 additions and 1 deletions

View File

@ -455,5 +455,14 @@ pub(crate) async fn resolve_true_destination(
}
pub(crate) fn memory_stats() -> RoomMessageEventContent {
RoomMessageEventContent::text_html("HTML only".to_owned(), crate::alloc::memory_stats())
let html_body = crate::alloc::memory_stats();
if html_body.is_empty() {
return RoomMessageEventContent::text_plain("malloc stats are not supported on your compiled malloc.");
}
RoomMessageEventContent::text_html(
"This command's output can only be viewed by clients that render HTML.".to_owned(),
html_body,
)
}