sharp-chat/SharpChat.SockChat/Commands/SockChatClientCommandContext.cs

35 lines
1 KiB
C#
Raw Normal View History

using System;
using System.Linq;
namespace SharpChat.SockChat.Commands {
public class SockChatClientCommandContext {
public string Name { get; }
public string[] Args { get; }
public SockChatContext Chat { get; }
public UserInfo User { get; }
public SockChatConnectionInfo Connection { get; }
public ChannelInfo Channel { get; }
public SockChatClientCommandContext(
string text,
SockChatContext chat,
UserInfo user,
SockChatConnectionInfo connection,
ChannelInfo channel
) {
Chat = chat;
User = user;
Connection = connection;
Channel = channel;
string[] parts = text[1..].Split(' ');
Name = parts.First().Replace(".", string.Empty);
Args = parts.Skip(1).ToArray();
}
public bool NameEquals(string name) {
return Name.Equals(name, StringComparison.InvariantCultureIgnoreCase);
}
}
}