From 6bd02248ccfbcb46960a6f39eaad23888d190eb5 Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Fri, 15 Sep 2023 09:50:45 +0200 Subject: Some refactoring --- LibMatrix/Helpers/MessageFormatter.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'LibMatrix/Helpers/MessageFormatter.cs') 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 = $"{error}: {error}", 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 = $"{error}:
{e.Message}
" + $"
", 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 = $"{text}", 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 = $"{text}:
{data.ToJson(ignoreNull: true)}
", Format = "org.matrix.custom.html" }; -- cgit 1.4.1