Initial commit

This commit is contained in:
barelyprofessional
2024-03-25 20:11:49 +08:00
commit 9f92fc8e27
62 changed files with 17831 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
using KfChatDotNetWsClient.Models.Json;
using Websocket.Client;
namespace KfChatDotNetWsClient.Models.Events;
public class EventHandlers
{
public delegate void OnMessagesEventHandler(object sender, List<MessageModel> messages,
MessagesJsonModel jsonPayload);
// When a user first joins the chat, this event will fire with the entire user list (which may be massive)
// But when users join in the course of a regular chat, it'll be one at a time
public delegate void OnUsersJoinedEventHandler(object sender, List<UserModel> users, UsersJsonModel jsonPayload);
// Usually only one user parts at a time, but theoretically the model could support more than one at a time
public delegate void OnUsersPartedEventHandler(object sender, List<int> userIds);
public delegate void OnWsReconnectEventHandler(object sender, ReconnectionInfo reconnectionInfo);
// Usually only one is sent at a time but it is a list hence the pluralization
public delegate void OnDeleteMessagesEventHandler(object sender, List<int> messageIds);
public delegate void OnWsDisconnectionEventHandler(object sender, DisconnectionInfo disconnectionInfo);
public delegate void OnFailedToJoinRoom(object sender, string message);
public delegate void OnUnknownCommand(object sender, string message);
}

View File

@@ -0,0 +1,12 @@
namespace KfChatDotNetWsClient.Models.Events;
public class MessageModel
{
public UserModel Author { get; set; }
public string Message { get; set; }
public int MessageId { get; set; }
public DateTimeOffset? MessageEditDate { get; set; }
public DateTimeOffset MessageDate { get; set; }
public string MessageRaw { get; set; }
public int RoomId { get; set; }
}

View File

@@ -0,0 +1,10 @@
namespace KfChatDotNetWsClient.Models.Events;
public class UserModel
{
public int Id { get; set; }
public string Username { get; set; }
public Uri AvatarUrl { get; set; }
// Unset if it's related to a chat message
public DateTimeOffset? LastActivity { get; set; }
}