diff options
author | Rory& <root@rory.gay> | 2024-03-15 19:51:21 +0100 |
---|---|---|
committer | Rory& <root@rory.gay> | 2024-03-15 19:51:21 +0100 |
commit | 89f61274be01320358fced2159acb4b8871d3680 (patch) | |
tree | 285ec36b520bdc4e1316a3d4fb266ee7363413a1 /LibMatrix/Helpers | |
parent | Bot changes, move named filters to subclass (diff) | |
download | LibMatrix-bak-89f61274be01320358fced2159acb4b8871d3680.tar.xz |
Add AddCollapsiblePart to MessageBuilder
Diffstat (limited to 'LibMatrix/Helpers')
-rw-r--r-- | LibMatrix/Helpers/MessageBuilder.cs | 13 |
1 files changed, 13 insertions, 0 deletions
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 += $"<pre><code class=\"language-{language}\">{code}</code></pre>"; return this; } + + public MessageBuilder WithCollapsibleSection(string title, string body) { + Content.Body += body; + Content.FormattedBody += $"<details><summary>{title}</summary>{body}</details>"; + return this; + } + + public MessageBuilder WithCollapsibleSection(string title, Action<MessageBuilder> bodyBuilder) { + Content.FormattedBody += $"<details><summary>{title}</summary>"; + bodyBuilder(this); + Content.FormattedBody += "</details>"; + return this; + } } \ No newline at end of file |