From 89f61274be01320358fced2159acb4b8871d3680 Mon Sep 17 00:00:00 2001 From: Rory& Date: Fri, 15 Mar 2024 19:51:21 +0100 Subject: Add AddCollapsiblePart to MessageBuilder --- LibMatrix/Helpers/MessageBuilder.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/LibMatrix/Helpers/MessageBuilder.cs b/LibMatrix/Helpers/MessageBuilder.cs index 07953e3..0753aca 100644 --- a/LibMatrix/Helpers/MessageBuilder.cs +++ b/LibMatrix/Helpers/MessageBuilder.cs @@ -78,4 +78,17 @@ public class MessageBuilder(string msgType = "m.text", string format = "org.matr Content.FormattedBody += $"
{code}
"; return this; } + + public MessageBuilder WithCollapsibleSection(string title, string body) { + Content.Body += body; + Content.FormattedBody += $"
{title}{body}
"; + return this; + } + + public MessageBuilder WithCollapsibleSection(string title, Action bodyBuilder) { + Content.FormattedBody += $"
{title}"; + bodyBuilder(this); + Content.FormattedBody += "
"; + return this; + } } \ No newline at end of file -- cgit 1.4.1