sharp-chat/SharpChat/Packet/AuthSuccessPacket.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

26 lines
788 B
C#

using System.Text;
namespace SharpChat.Packet {
public class AuthSuccessPacket(
ChatUser user,
ChatChannel channel,
int maxMsgLength
) : IServerPacket {
public ChatUser User { get; private set; } = user ?? throw new ArgumentNullException(nameof(user));
public ChatChannel Channel { get; private set; } = channel ?? throw new ArgumentNullException(nameof(channel));
public IEnumerable<string> Pack() {
StringBuilder sb = new();
sb.Append('1');
sb.Append("\ty\t");
sb.Append(User.Pack());
sb.Append('\t');
sb.Append(Channel.Name);
sb.Append('\t');
sb.Append(maxMsgLength);
yield return sb.ToString();
}
}
}