about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-05-24 20:59:49 +0200
committerRory& <root@rory.gay>2025-05-24 20:59:49 +0200
commit94b6b1e845cc867681d88e6d6673ce71f67a889d (patch)
tree2ad69e1200e00ee70686ed543fff8f66214ca5f2
parentSupport takedown policies and hashed entities (diff)
downloadLibMatrix-master.tar.xz
Expose colored string as static in MessageBuilder HEAD master
-rw-r--r--LibMatrix/Helpers/MessageBuilder.cs6
1 files changed, 5 insertions, 1 deletions
diff --git a/LibMatrix/Helpers/MessageBuilder.cs b/LibMatrix/Helpers/MessageBuilder.cs

index 87a9992..6f55739 100644 --- a/LibMatrix/Helpers/MessageBuilder.cs +++ b/LibMatrix/Helpers/MessageBuilder.cs
@@ -37,6 +37,10 @@ public class MessageBuilder(string msgType = "m.text", string format = "org.matr return this; } + public static string GetColoredBody(string color, string body) { + return $"<font color=\"{color}\">{body}</font>"; + } + public MessageBuilder WithColoredBody(string color, string body) { Content.Body += body; Content.FormattedBody += $"<font color=\"{color}\">{body}</font>"; @@ -94,7 +98,7 @@ public class MessageBuilder(string msgType = "m.text", string format = "org.matr public MessageBuilder WithMention(string id, string? displayName = null) { Content.Body += $"@{displayName ?? id}"; Content.FormattedBody += $"<a href=\"https://matrix.to/#/{id}\">{displayName ?? id}</a>"; - if(id == "@room") { + if (id == "@room") { Content.Mentions ??= new(); Content.Mentions.Room = true; }