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

19 lines
720 B
C#

namespace SharpChat {
public class ChatPacketHandlerContext(
string text,
ChatContext chat,
ChatConnection connection
) {
public string Text { get; } = text ?? throw new ArgumentNullException(nameof(text));
public ChatContext Chat { get; } = chat ?? throw new ArgumentNullException(nameof(chat));
public ChatConnection Connection { get; } = connection ?? throw new ArgumentNullException(nameof(connection));
public bool CheckPacketId(string packetId) {
return Text == packetId || Text.StartsWith(packetId + '\t');
}
public string[] SplitText(int expect) {
return Text.Split('\t', expect + 1);
}
}
}