using TwitchChatTTS.Chat.Commands.Parameters; using TwitchLib.Client.Models; namespace TwitchChatTTS.Chat.Commands { public abstract class ChatCommand { public string Name { get; } public string Description { get; } public IList Parameters { get => _parameters.AsReadOnly(); } public bool DefaultPermissionsOverwrite { get; } private IList _parameters; public ChatCommand(string name, string description) { Name = name; Description = description; DefaultPermissionsOverwrite = false; _parameters = new List(); } protected void AddParameter(ChatCommandParameter parameter, bool optional = false) { if (parameter != null && parameter.Clone() is ChatCommandParameter p) { _parameters.Add(optional ? p.Permissive() : p); } } public abstract Task CheckDefaultPermissions(ChatMessage message, long broadcasterId); public abstract Task Execute(IList args, ChatMessage message, long broadcasterId); } }