{e.Message}",
Format = "org.matrix.custom.html"
};
}
public static RoomMessageEventContent FormatSuccess(string text) {
return new RoomMessageEventContent(body: text, messageType: "m.text") {
FormattedBody = $"{text}",
Format = "org.matrix.custom.html"
};
}
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"
};
}
public static string HtmlFormatMention(string id, string? displayName = null) {
return $"{displayName ?? id}";
}
#region Extension functions
public static RoomMessageEventContent ToMatrixMessage(this Exception e, string error) => FormatException(error, e);
#endregion
}