sharp-chat/SharpChat/ChatCommandContext.cs

35 lines
978 B
C#
Raw Normal View History

using System;
using System.Linq;
namespace SharpChat {
public class ChatCommandContext {
public string Name { get; }
public string[] Args { get; }
public ChatContext Chat { get; }
public ChatUser User { get; }
2023-02-16 21:25:41 +00:00
public ChatConnection Connection { get; }
public ChatChannel Channel { get; }
public ChatCommandContext(
string text,
ChatContext chat,
ChatUser user,
2023-02-16 21:25:41 +00:00
ChatConnection connection,
ChatChannel 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);
}
}
}