//public void Register(string incomingMessageRegexPattern, string responseMessage, // MessageKeyboard messageKeyboard = null, // RegexOptions incomingMessageRegexPatternOptions = RegexOptions.IgnoreCase) //{ // _regexToActionTemplates.Add(new RegexToActionTemplate(incomingMessageRegexPattern, responseMessage, // messageKeyboard, incomingMessageRegexPatternOptions)); //} //public void Register(string incomingMessageRegexPattern, List<string> responseMessages, // MessageKeyboard messageKeyboard = null, // RegexOptions incomingMessageRegexPatternOptions = RegexOptions.IgnoreCase) //{ // _regexToActionTemplates.Add(new RegexToActionTemplate(incomingMessageRegexPattern, responseMessages, // messageKeyboard, incomingMessageRegexPatternOptions)); //} //public void Register(string incomingMessageRegexPattern, Action<VkBot, Message> callback, // RegexOptions incomingMessageRegexPatternOptions = RegexOptions.IgnoreCase) //{ // _regexToActionTemplates.Add(new RegexToActionTemplate(incomingMessageRegexPattern, callback, // incomingMessageRegexPatternOptions)); //} public void Unregister(RegexToActionTemplate template) { lock (_regexToActionTemplatesLock) { _regexToActionTemplates.Remove(template); } }
public void Register(RegexToActionTemplate template) { if (template == null) { throw new ArgumentNullException(nameof(template)); } lock (_regexToActionTemplatesLock) { _regexToActionTemplates.Add(template); } }