public async Task GetDocumentationAsync([Remainder] string term) { var response = await DocumentationService.GetDocumentationResultsAsync(term); if (response.Count == 0) { await ReplyAsync("Could not find documentation for your requested term."); return; } var embedCount = 0; foreach (var res in response.Results.Take(3).OrderBy(x => x.DisplayName)) { embedCount++; var builder = new EmbedBuilder() .WithColor(new Color(46, 204, 113)) .WithTitle($"{res.ItemKind}: {res.DisplayName}") .WithUrl(res.Url) .WithDescription(res.Description); if (embedCount == 3) { builder.WithFooter( new EmbedFooterBuilder().WithText($"{embedCount}/{response.Results.Count} https://docs.microsoft.com/dotnet/api/?term={term}") ); builder.Footer.Build(); } await ReplyAsync("", embed : builder.Build()); } }
public HelpModule(CommandService service, IConfigurationRoot config, LoggingService logger, DocumentationService docService) { this.service = service; this.config = config; this.logger = logger; this.docService = docService; }
public PartialViewResult Navigation(string id) { var builder = new DocumentationService(); var model = builder.Build(id); return(this.PartialView(model)); }
// GET: Documentation public ActionResult Index(String id) { var builder = new DocumentationService(); var model = builder.Build(id); return(View(model)); }
protected override async Task OnParametersSetAsync() { await base.OnParametersSetAsync(); examples.Clear(); StateHasChanged(); document = await DocumentationService.GetComponentDocumentation(ComponentName); await foreach (var example in document.Examples) { examples.Add(example); StateHasChanged(); } }
public static void Initialize() { var tmp = new TcpListener(IPAddress.Any, 0); tmp.Start(); HostName = "localhost:" + ((IPEndPoint)tmp.LocalEndpoint).Port; tmp.Stop(); var docs = new DocumentationService(); AddService(docs); LogService = new LogService(); log = LogService.CreateLog("REST"); }
public DocumentationModule(DocumentationService documentationService) { DocumentationService = documentationService; }
public async Task GetDocumentationAsync( [Remainder] [Summary("The term to search for in the documentation.")] string term) { Regex reg = new Regex("^[0-9A-Za-z.<>]$"); foreach (char c in term) { if (!reg.IsMatch(c.ToString())) { //Double the escape char so discord will print it as well string s = (c == '\\') ? "\\\\" : c.ToString(); await ReplyAsync($" '{s}' character is not allowed in the search, please try again."); return; } } var response = await DocumentationService.GetDocumentationResultsAsync(term); if (response.Count == 0) { await ReplyAsync("Could not find documentation for your requested term."); return; } var embedCount = 0; var stringBuild = new StringBuilder(); foreach (var res in response.Results.Take(3)) { embedCount++; stringBuild.AppendLine($"**\u276F [{res.ItemKind}: {res.DisplayName}]({res.Url})**"); stringBuild.AppendLine($"{res.Description}"); stringBuild.AppendLine(); if (embedCount == 3) { stringBuild.Append( $"{embedCount}/{response.Results.Count} results shown ~ [Click Here for more results](https://docs.microsoft.com/dotnet/api/?term={term})" ); } } var buildEmbed = new EmbedBuilder() { Description = stringBuild.ToString() }.WithColor(new Color(46, 204, 113)); var message = await ReplyAsync(embed : buildEmbed.Build()); await _autoRemoveMessageService.RegisterRemovableMessageAsync(Context.User, buildEmbed, async (e) => { await message.ModifyAsync(a => { a.Content = string.Empty; a.Embed = e.Build(); }); return(message); }); await Context.Message.DeleteAsync(); }
public DocumentationModule(DocumentationService documentationService, IAutoRemoveMessageService autoRemoveMessageService) { DocumentationService = documentationService; _autoRemoveMessageService = autoRemoveMessageService; }
public DocumentationsController(DocumentationService documentationService, IOptionsSnapshot <GlobalSettings> settings) { _documentationService = documentationService; _settings = settings.Value; }
public PostmanCollection GetDiscovery() { var service = new DocumentationService(); return(service.GetDiscovery("Scribe API", Request.RequestUri)); }