Move message processing to javascript, future proofing it for other frameworks

This commit is contained in:
Infi
2024-08-30 13:31:58 +02:00
parent db3d513f9e
commit ff223bda2e
3 changed files with 102 additions and 37 deletions
+14 -3
View File
@@ -3,9 +3,9 @@
namespace ChatTwo.Http.MessageProtocol;
#region Outgoing SSE
public struct SwitchChannel(string name)
public struct SwitchChannel(MessageTemplate[] channelName)
{
[JsonProperty("channel")] public string Name = name;
[JsonProperty("channelName")] public MessageTemplate[] ChannelName = channelName;
}
public struct ChannelList(Dictionary<string, uint> channels)
@@ -21,7 +21,18 @@ public struct Messages(MessageResponse[] set)
public struct MessageResponse()
{
[JsonProperty("timestamp")] public string Timestamp = "";
[JsonProperty("messageHTML")] public string Message = "";
[JsonProperty("templates")] public MessageTemplate[] Templates;
}
public struct MessageTemplate()
{
[JsonProperty("payload")] public required string Payload;
[JsonProperty("content")] public string Content = "";
[JsonProperty("id")] public uint Id;
[JsonProperty("color")] public uint Color;
public static MessageTemplate Empty => new() {Payload = "empty"};
}
#endregion