public async Task <ProbationItem> CheckForProbation() { if (!_webManager.IsAuthenticated) { throw new Exception("User must be authenticated before using this method."); } var result = await _webManager.GetDataAsync(EndPoints.BaseUrl); var document = await _webManager.Parser.ParseAsync(result.ResultHtml); var prob = BanHandler.ParseForProbation(document); _webManager.Probation = prob; return(prob); }
/// <summary> /// Pings the main forums page and checks if the user under probation. /// </summary> /// <param name="token">A CancellationToken.</param> /// <returns>A ProbationItem.</returns> public async Task <ProbationItem> CheckForProbation(CancellationToken token = default) { if (!this.webManager.IsAuthenticated) { throw new UserAuthenticationException(Awful.Core.Resources.ExceptionMessages.UserAuthenticationError); } var result = await this.webManager.GetDataAsync(EndPoints.BaseUrl, token).ConfigureAwait(false); var document = await this.webManager.Parser.ParseDocumentAsync(result.ResultHtml, token).ConfigureAwait(false); var prob = BanHandler.ParseForProbation(document); this.webManager.Probation = prob; return(prob); }