diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-09-15 09:50:45 +0200 |
---|---|---|
committer | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-09-15 09:50:45 +0200 |
commit | 6bd02248ccfbcb46960a6f39eaad23888d190eb5 (patch) | |
tree | 110578f31b6f9f70a7a1edab32fb3a34d6ad4f1a /LibMatrix/Helpers/MessageFormatter.cs | |
parent | Media moderator PoC works, abstract command handling to library (diff) | |
download | LibMatrix-bak-6bd02248ccfbcb46960a6f39eaad23888d190eb5.tar.xz |
Some refactoring
Diffstat (limited to 'LibMatrix/Helpers/MessageFormatter.cs')
-rw-r--r-- | LibMatrix/Helpers/MessageFormatter.cs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/LibMatrix/Helpers/MessageFormatter.cs b/LibMatrix/Helpers/MessageFormatter.cs index ff0a00f..37d7004 100644 --- a/LibMatrix/Helpers/MessageFormatter.cs +++ b/LibMatrix/Helpers/MessageFormatter.cs @@ -4,30 +4,30 @@ using LibMatrix.StateEventTypes.Spec; namespace LibMatrix.Helpers; public static class MessageFormatter { - public static RoomMessageEventData FormatError(string error) { - return new RoomMessageEventData(body: error, messageType: "m.text") { + public static RoomMessageEventContent FormatError(string error) { + return new RoomMessageEventContent(body: error, messageType: "m.text") { FormattedBody = $"<font color=\"#FF0000\">{error}: {error}</font>", Format = "org.matrix.custom.html" }; } - public static RoomMessageEventData FormatException(string error, Exception e) { - return new RoomMessageEventData(body: $"{error}: {e.Message}", messageType: "m.text") { + public static RoomMessageEventContent FormatException(string error, Exception e) { + return new RoomMessageEventContent(body: $"{error}: {e.Message}", messageType: "m.text") { FormattedBody = $"<font color=\"#FF0000\">{error}: <pre>{e.Message}</pre>" + $"</font>", Format = "org.matrix.custom.html" }; } - public static RoomMessageEventData FormatSuccess(string text) { - return new RoomMessageEventData(body: text, messageType: "m.text") { + public static RoomMessageEventContent FormatSuccess(string text) { + return new RoomMessageEventContent(body: text, messageType: "m.text") { FormattedBody = $"<font color=\"#00FF00\">{text}</font>", Format = "org.matrix.custom.html" }; } - public static RoomMessageEventData FormatSuccessJson(string text, object data) { - return new RoomMessageEventData(body: text, messageType: "m.text") { + public static RoomMessageEventContent FormatSuccessJson(string text, object data) { + return new RoomMessageEventContent(body: text, messageType: "m.text") { FormattedBody = $"<font color=\"#00FF00\">{text}: <pre>{data.ToJson(ignoreNull: true)}</pre></font>", Format = "org.matrix.custom.html" }; |