/// <summary> /// Determines whether this instance can handle the specified message. /// </summary> /// <param name="message">The message info.</param> /// <returns></returns> public override MessageHandlingResponse CanHandle(Message message) { MessageHandlingResponse response = new MessageHandlingResponse(); foreach (string regexPattern in qas.Keys) { Match match = Regex.Match(message.Content, regexPattern, RegexOptions.IgnoreCase); if (match.Success && match.Groups["term"] != null) { string term = match.Groups["term"].Value.ToLower(); if (qas[regexPattern].ContainsKey(term)) { reply = qas[regexPattern][term]; response.Confidence = this.DefaultConfidence; break; } else if (qas[regexPattern].ContainsKey("default")) { reply = qas[regexPattern]["default"]; response.Confidence = this.DefaultConfidence; break; } } } return(response); }
/// <summary> /// Determines whether this instance can handle the specified message. /// </summary> /// <param name="message">The message info.</param> /// <returns></returns> public virtual MessageHandlingResponse CanHandle(Message message) { MessageHandlingResponse response = new MessageHandlingResponse(); if (this.inputMatcher != null && inputMatcher.CanHandle(message.Content)) { response.Confidence = this.DefaultConfidence; response.InitialHandlingText = this.GetInitialHandlingText(); } return(response); }