From 031ed60ebc215def0c5c8760d5329f07ffe5d2a4 Mon Sep 17 00:00:00 2001 From: Nora <51166756+AnalogFeelings@users.noreply.github.com> Date: Sun, 14 Apr 2024 01:23:12 +0200 Subject: [PATCH] [Docs] Updates and tweaks. (#2907) * Update to docfx 2.76.0 and fix newly introduced issue. * Enable affix in index page. * Fix some missing references in docs. * Fixed some more references in docs. * Update docs workflow to 2.76.0. --- .github/workflows/docs.yml | 2 +- docs/README.md | 2 +- docs/_template/material/public/main.js | 3 +++ docs/guides/int_framework/autocompletion.md | 9 ++++----- docs/guides/int_framework/intro.md | 16 ++++++++++------ docs/guides/int_framework/typeconverters.md | 2 +- docs/index.md | 3 ++- 7 files changed, 22 insertions(+), 15 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index c3f0cb36..0e8dd09d 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -27,7 +27,7 @@ jobs: dotnet-version: 8.0.x - name: Setup DocFX - run: dotnet tool install -g docfx --version 2.75.2 + run: dotnet tool install -g docfx --version 2.76.0 - name: Build DNet docs run: docfx docs/docfx.json diff --git a/docs/README.md b/docs/README.md index b856b8b3..20e41f6a 100644 --- a/docs/README.md +++ b/docs/README.md @@ -4,7 +4,7 @@ The documentation for the Discord.Net library uses [DocFX][docfx-main]. Instructions for installing this tool can be found [here][docfx-installing]. > [!IMPORTANT] -> You must use DocFX version **2.75.2** for everything to work. +> You must use DocFX version **2.76.0** for everything to work correctly. 1. Navigate to the root of the repository. 2. Build the docs using `docfx docs/docfx.json`. Add the `--serve` diff --git a/docs/_template/material/public/main.js b/docs/_template/material/public/main.js index 6721457f..facbb639 100644 --- a/docs/_template/material/public/main.js +++ b/docs/_template/material/public/main.js @@ -22,6 +22,9 @@ { // Ugly hack to improve toc filter. let target = document.getElementById("toc"); + + if(!target) return; + let config = { attributes: false, childList: true, subtree: true }; let observer = new MutationObserver((list) => { diff --git a/docs/guides/int_framework/autocompletion.md b/docs/guides/int_framework/autocompletion.md index c0989901..35b48589 100644 --- a/docs/guides/int_framework/autocompletion.md +++ b/docs/guides/int_framework/autocompletion.md @@ -5,8 +5,8 @@ title: Command Autocompletion # AutocompleteHandlers -[Autocompleters] provide a similar pattern to TypeConverters. -[Autocompleters] are cached, singleton services and they are used by the +[AutocompleteHandler]s provide a similar pattern to TypeConverters. +[AutocompleteHandler]s are cached, singleton services and they are used by the Interaction Service to handle Autocomplete Interactions targeted to a specific Slash Command parameter. To start using AutocompleteHandlers, use the `[AutocompleteAttribute(Type type)]` overload of the [AutocompleteAttribute]. @@ -37,13 +37,12 @@ AutocompleteHandler dependencies are resolved using the same dependency injectio pattern as the Interaction Modules. Property injection and constructor injection are both valid ways to get service dependencies. -Because [AutocompleterHandlers] are constructed at service startup, +Because [AutocompleteHandler]s are constructed at service startup, class dependencies are resolved only once. > [!NOTE] > If you need to access per-request dependencies you can use the > IServiceProvider parameter of the `GenerateSuggestionsAsync()` method. -[AutoCompleteHandlers]: xref:Discord.Interactions.AutocompleteHandler [AutoCompleteHandler]: xref:Discord.Interactions.AutocompleteHandler -[AutoCompleteAttribute]: +[AutoCompleteAttribute]: xref:Discord.Interactions.AutocompleteAttribute diff --git a/docs/guides/int_framework/intro.md b/docs/guides/int_framework/intro.md index ccec38ac..7718fbf2 100644 --- a/docs/guides/int_framework/intro.md +++ b/docs/guides/int_framework/intro.md @@ -165,7 +165,7 @@ Interaction service complex parameter constructors are prioritized in the follow #### DM Permissions > [!WARNING] -> [EnabledInDmAttribute] is being deprecated in favor of [CommandContextTypes] attribute. +> [EnabledInDmAttribute] is being deprecated in favor of [CommandContextType] attribute. You can use the [EnabledInDmAttribute] to configure whether a globally-scoped top level command should be enabled in Dms or not. Only works on top level commands. @@ -257,7 +257,7 @@ To achieve this, make sure your module classes inherit from the generic variant The [InteractionService] ships with 4 different kinds of [InteractionContext]: -1. [InteractionContext]]: A bare-bones execution context consisting of only implementation neutral interfaces +1. [InteractionContext]: A bare-bones execution context consisting of only implementation neutral interfaces 2. [SocketInteractionContext]: An execution context for use with [DiscordSocketClient]. Socket entities are exposed in this context without the need of casting them. 3. [ShardedInteractionContext]: [DiscordShardedClient] variant of the [SocketInteractionContext] 4. [RestInteractionContext]: An execution context designed to be used with a [DiscordRestClient] and webhook based interactions pattern @@ -266,7 +266,7 @@ You can create custom Interaction Contexts by implementing the [IInteractionCont One problem with using the concrete type InteractionContexts is that you cannot access the information that is specific to different interaction types without casting. Concrete type interaction contexts are great for creating shared interaction modules but you can also use the generic variants of the built-in interaction contexts to create interaction specific interaction modules. -> [!INFO] +> [!NOTE] > Message component interactions have access to a special method called `UpdateAsync()` to update the body of the method the interaction originated from. > Normally this wouldn't be accessible without casting the `Context.Interaction`. @@ -329,7 +329,7 @@ This behaviour can be configured by changing the `RunMode` property of `Interact > [!WARNING] > In the example above, no form of post-execution is presented. -> Please carefully read the [Post Execution Documentation] for the best approach in resolving the result based on your `RunMode`. +> Please carefully read the [Post-Execution Documentation] for the best approach in resolving the result based on your `RunMode`. You can also configure the way [InteractionService] executes the commands. By default, commands are executed using `ConstructorInfo.Invoke()` to create module instances and @@ -429,6 +429,7 @@ User apps are the kind of Discord applications that are installed onto a user in [AutocompleteHandlers]: xref:Guides.IntFw.AutoCompletion [DependencyInjection]: xref:Guides.DI.Intro +[Post-Execution Documentation]: xref:Guides.IntFw.PostExecution [GroupAttribute]: xref:Discord.Interactions.GroupAttribute [DontAutoRegisterAttribute]: xref:Discord.Interactions.DontAutoRegisterAttribute @@ -445,10 +446,11 @@ User apps are the kind of Discord applications that are installed onto a user in [ModalExecuted]: xref:Discord.WebSocket.BaseSocketClient [DiscordSocketClient]: xref:Discord.WebSocket.DiscordSocketClient [DiscordRestClient]: xref:Discord.Rest.DiscordRestClient +[DiscordShardedClient]: xref:Discord.WebSocket.DiscordShardedClient [SocketInteractionContext]: xref:Discord.Interactions.SocketInteractionContext [ShardedInteractionContext]: xref:Discord.Interactions.ShardedInteractionContext [InteractionContext]: xref:Discord.Interactions.InteractionContext -[IInteractionContect]: xref:Discord.Interactions.IInteractionContext +[IInteractionContext]: xref:Discord.IInteractionContext [RestInteractionContext]: xref:Discord.Rest.RestInteractionContext [SummaryAttribute]: xref:Discord.Interactions.SummaryAttribute [ChoiceAttribute]: xref:Discord.Interactions.ChoiceAttribute @@ -456,9 +458,11 @@ User apps are the kind of Discord applications that are installed onto a user in [MaxValueAttribute]: xref:Discord.Interactions.MaxValueAttribute [MinValueAttribute]: xref:Discord.Interactions.MinValueAttribute [EnabledInDmAttribute]: xref:Discord.Interactions.EnabledInDmAttribute -[CommandContextTypes]: xref:Discord.Interactions.CommandContextTypesAttribute +[CommandContextType]: xref:Discord.Interactions.CommandContextTypeAttribute +[DefaultMemberPermissionsAttribute]: xref:Discord.Interactions.DefaultMemberPermissionsAttribute [IChannel]: xref:Discord.IChannel +[IAttachment]: xref:Discord.IAttachment [IRole]: xref:Discord.IRole [IUser]: xref:Discord.IUser [IMessage]: xref:Discord.IMessage diff --git a/docs/guides/int_framework/typeconverters.md b/docs/guides/int_framework/typeconverters.md index 96bdcb90..7907bd3c 100644 --- a/docs/guides/int_framework/typeconverters.md +++ b/docs/guides/int_framework/typeconverters.md @@ -5,7 +5,7 @@ title: Parameter Type Converters # TypeConverters -[TypeConverters] are responsible for registering command parameters to Discord and parsing the user inputs into method parameters. +[TypeConverter]s are responsible for registering command parameters to Discord and parsing the user inputs into method parameters. By default, TypeConverters for the following types are provided with @Discord.Interactions library. diff --git a/docs/index.md b/docs/index.md index 6025ad36..ed0da649 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,7 +1,8 @@ --- uid: Home.Landing title: Home -_layout: landing +_disableToc: true +_disableBreadcrumb: true --- ![logo](marketing/logo/SVG/Combinationmark%20White%20Border.svg)