sharp-chat/SharpChat/Packet/UserConnectPacket.cs
flashwave e17aed7c25
Switched to Index brand random Snowflakes instead of SharpIds.
If you were still handling message ids as integers in an environment that can't handle signed 64-bit integers you're going to be having a fun time after this update!
2025-04-25 20:05:57 +00:00

21 lines
638 B
C#

using System.Text;
namespace SharpChat.Packet {
public class UserConnectPacket(long msgId, DateTimeOffset joined, ChatUser user) : IServerPacket {
public ChatUser User { get; private set; } = user ?? throw new ArgumentNullException(nameof(user));
public IEnumerable<string> Pack() {
StringBuilder sb = new();
sb.Append('1');
sb.Append('\t');
sb.Append(joined.ToUnixTimeSeconds());
sb.Append('\t');
sb.Append(User.Pack());
sb.Append('\t');
sb.Append(msgId);
yield return sb.ToString();
}
}
}