private InteractiveResponse EvaluateResponseType(SocketMessage message, InteractiveMessage interactiveMessage, InteractiveResponse response) { switch (interactiveMessage.ResponseType) { case InteractiveTextResponseType.Channel: if (message.ContainsChannel()) { response.CriteriaResult = CriteriaResult.Success; } break; case InteractiveTextResponseType.User: if (message.ContainsUser()) { response.CriteriaResult = CriteriaResult.Success; } break; case InteractiveTextResponseType.Role: if (message.ContainsRole()) { response.CriteriaResult = CriteriaResult.Success; } break; case InteractiveTextResponseType.Options: if (message.ContainsWords(1, interactiveMessage.CaseSensitive, interactiveMessage.Options)) { response.CriteriaResult = CriteriaResult.Success; } break; case InteractiveTextResponseType.Any: response.CriteriaResult = CriteriaResult.Success; break; default: throw new ArgumentOutOfRangeException(); } return(response); }
private async Task <InteractiveResponse> EvaluateResponse(SocketMessage message, InteractiveMessage interactiveMessage) { var response = new InteractiveResponse(CriteriaResult.WrongResponse, message); if (interactiveMessage.CancelationWords != null) { if (message.ContainsWords(1, interactiveMessage.CaseSensitive, interactiveMessage.CancelationWords)) { response.CriteriaResult = CriteriaResult.Canceled; response.Message = null; return(response); } } response = EvaluateResponseType(message, interactiveMessage, response); if (response.CriteriaResult != CriteriaResult.Success && interactiveMessage.ResponseType != InteractiveTextResponseType.Any) { await interactiveMessage.SendWrongResponseMessages(); } return(response); }