about summary refs log tree commit diff
path: root/LibMatrix/Helpers/MessageBuilder.cs
diff options
context:
space:
mode:
authorEmma [it/its]@Rory& <root@rory.gay>2024-02-09 16:32:46 +0100
committerEmma [it/its]@Rory& <root@rory.gay>2024-02-09 16:32:46 +0100
commit4ef9ae4b396b0eb37036d4008e8cb40e468dbe73 (patch)
tree6bb4d25754fefc52333a5fc44dd721c333314240 /LibMatrix/Helpers/MessageBuilder.cs
parentConsistently use EventId for event types (diff)
downloadLibMatrix-4ef9ae4b396b0eb37036d4008e8cb40e468dbe73.tar.xz
Apply syntax style to LibMatrix
Diffstat (limited to 'LibMatrix/Helpers/MessageBuilder.cs')
-rw-r--r--LibMatrix/Helpers/MessageBuilder.cs31
1 files changed, 12 insertions, 19 deletions
diff --git a/LibMatrix/Helpers/MessageBuilder.cs b/LibMatrix/Helpers/MessageBuilder.cs
index 250187a..68f6300 100644
--- a/LibMatrix/Helpers/MessageBuilder.cs
+++ b/LibMatrix/Helpers/MessageBuilder.cs
@@ -8,46 +8,42 @@ public class MessageBuilder(string msgType = "m.text", string format = "org.matr
         MessageType = msgType,
         Format = format
     };
-    
+
     public RoomMessageEventContent Build() => Content;
-    
+
     public MessageBuilder WithBody(string body) {
         Content.Body += body;
         Content.FormattedBody += body;
         return this;
     }
-    
+
     public MessageBuilder WithHtmlTag(string tag, string body, Dictionary<string, string>? attributes = null) {
         Content.Body += body;
         Content.FormattedBody += $"<{tag}";
-        if (attributes != null) {
-            foreach (var (key, value) in attributes) {
+        if (attributes != null)
+            foreach (var (key, value) in attributes)
                 Content.FormattedBody += $" {key}=\"{value}\"";
-            }
-        }
         Content.FormattedBody += $">{body}</{tag}>";
         return this;
     }
-    
+
     public MessageBuilder WithHtmlTag(string tag, Action<MessageBuilder> bodyBuilder, Dictionary<string, string>? attributes = null) {
         Content.FormattedBody += $"<{tag}";
-        if (attributes != null) {
-            foreach (var (key, value) in attributes) {
+        if (attributes != null)
+            foreach (var (key, value) in attributes)
                 Content.FormattedBody += $" {key}=\"{value}\"";
-            }
-        }
         Content.FormattedBody += ">";
         bodyBuilder(this);
         Content.FormattedBody += $"</{tag}>";
         return this;
     }
-    
+
     public MessageBuilder WithColoredBody(string color, string body) {
         Content.Body += body;
         Content.FormattedBody += $"<font color=\"{color}\">{body}</font>";
         return this;
     }
-    
+
     public MessageBuilder WithColoredBody(string color, Action<MessageBuilder> bodyBuilder) {
         Content.FormattedBody += $"<font color=\"{color}\">";
         bodyBuilder(this);
@@ -55,7 +51,7 @@ public class MessageBuilder(string msgType = "m.text", string format = "org.matr
         return this;
     }
 
-    public MessageBuilder WithRainbowString(string text, byte skip = 1, int offset = 0, double lengthFactor = 255.0, bool useLength = true) {
+    public MessageBuilder WithRainbowString(string text, byte skip = 1, int offset = 0, double lengthFactor = 255.0, bool useLength = true) =>
         // if (useLength) {
         //     lengthFactor = text.Length;
         // }
@@ -67,8 +63,5 @@ public class MessageBuilder(string msgType = "m.text", string format = "org.matr
         //     // Console.WriteLine($"RBA: {r} {g} {b} {a}");
         //     // Content.FormattedBody += $"<font color=\"#{r:X2}{g:X2}{b:X2}\">{text[i]}</font>";
         // }
-
-        return this;
-    }
-    
+        this;
 }
\ No newline at end of file