diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index d611e3f2..2c58fda6 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -6,6 +6,8 @@ on: - '*' paths: - 'docs/**' + branches: + - 'dev' workflow_dispatch: pull_request: paths: diff --git a/docs/_template/material/public/main.css b/docs/_template/material/public/main.css index 29d45ca8..35ffe8f8 100644 --- a/docs/_template/material/public/main.css +++ b/docs/_template/material/public/main.css @@ -184,8 +184,20 @@ code { } /* MAKES PARAMETERS MORE SPACIOUS */ -dl.parameters > dt > code { - padding: 3px; +:not(pre) > code { + padding: 3px; +} + +/* MAKES LIST ITEMS BE SLIGHTLY MORE SEPARATED */ +/* THIS AVOIDS CODE BLOCK OVERLAP */ +ul:not(.navbar-nav) > li:not(:last-child) { + margin-bottom: 4px; +} + +/* MAKES NAVBAR LINKS LOOK BETTER IN MOBILE */ +.navbar-expand-md .navbar-nav .nav-link { + padding-right: var(--bs-navbar-nav-link-padding-x); + padding-left: var(--bs-navbar-nav-link-padding-x); } /* MAKES INHERITANCE LIST READABLE */ diff --git a/docs/_template/material/public/main.js b/docs/_template/material/public/main.js index 442fa9fd..6721457f 100644 --- a/docs/_template/material/public/main.js +++ b/docs/_template/material/public/main.js @@ -1,14 +1,69 @@ -export default { - iconLinks: [ +export default +{ + iconLinks: + [ { icon: 'github', href: 'https://github.com/discord-net/Discord.Net', title: 'GitHub' }, + { + icon: 'box-seam-fill', + href: 'https://www.nuget.org/packages/Discord.Net/', + title: 'NuGet' + }, { icon: 'discord', href: 'https://discord.gg/dnet', title: 'Discord' } - ] + ], + start: () => + { + // Ugly hack to improve toc filter. + let target = document.getElementById("toc"); + let config = { attributes: false, childList: true, subtree: true }; + let observer = new MutationObserver((list) => + { + for(const mutation of list) + { + if(mutation.type === "childList" && mutation.target == target) + { + let filter = target.getElementsByClassName("form-control")[0]; + + let filterValue = localStorage.getItem("tocFilter"); + let scrollValue = localStorage.getItem("tocScroll"); + + if(filterValue && filterValue !== "") + { + filter.value = filterValue; + + let inputEvent = new Event("input"); + filter.dispatchEvent(inputEvent); + } + + // Add event to store scroll pos. + let tocDiv = target.getElementsByClassName("flex-fill")[0]; + + tocDiv.addEventListener("scroll", (event) => + { + if (event.target.scrollTop >= 0) + { + localStorage.setItem("tocScroll", event.target.scrollTop); + } + }); + + if(scrollValue && scrollValue >= 0) + { + tocDiv.scroll(0, scrollValue); + } + + observer.disconnect(); + break; + } + } + }); + + observer.observe(target, config); + } } diff --git a/docs/guides/int_framework/intro.md b/docs/guides/int_framework/intro.md index 3e3c7121..d1e00262 100644 --- a/docs/guides/int_framework/intro.md +++ b/docs/guides/int_framework/intro.md @@ -30,8 +30,8 @@ A new module instance is created before a command execution starts then it will Every module class must: -- be public -- inherit [InteractionModuleBase] +- Be public +- Inherit from [InteractionModuleBase] Optionally you can override the included : @@ -61,7 +61,7 @@ Valid **Interaction Commands** must comply with the following requirements: |[Autocomplete Command](#autocomplete-commands)| `Task`/`Task` | - | - | `[AutocompleteCommand]`| > [!NOTE] -> a `TypeConverter` that is capable of parsing type in question must be registered to the [InteractionService] instance. +> A `TypeConverter` that is capable of parsing type in question must be registered to the [InteractionService] instance. > You should avoid using long running code in your command module. > Depending on your setup, long running code may block the Gateway thread of your bot, interrupting its connection to Discord. @@ -94,13 +94,17 @@ By default, your methods can feature the following parameter types: - `sbyte`, `byte` - `int16`, `int32`, `int64` - `uint16`, `uint32`, `uint64` -- `enum` (Values are registered as multiple choice options and are enforced by Discord. Use the `[Hide]` attribute on enum values to prevent them from getting registered.) +- `enum` - `DateTime` - `TimeSpan` +> [!NOTE] +> Enum values are registered as multiple choice options and are enforced by Discord. Use the `[Hide]` attribute on enum values to prevent them from getting registered. + --- -**You can use more specialized implementations of [IChannel] to restrict the allowed channel types for a channel type option.* +**You can use more specialized implementations of [IChannel] to restrict the allowed channel types for a channel type option.** + | interface | Channel Type | |---------------------|-------------------------------| | `IStageChannel` | Stage Channels |