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); }
private async Task SendCriteriaErrorMessages(InteractiveMessage interactiveMessage, InteractiveResponse response) { switch (response.CriteriaResult) { case CriteriaResult.Timeout: await interactiveMessage.SendTimeoutMessages(); break; case CriteriaResult.Canceled: await interactiveMessage.SendCancellationMessages(); break; case CriteriaResult.Success: break; case CriteriaResult.WrongResponse: break; default: throw new ArgumentOutOfRangeException(); } }