![]() |
VOOZH | about |
dotnet add package J4asper.DSharpPlus.BetterPagination --version 1.2.0
NuGet\Install-Package J4asper.DSharpPlus.BetterPagination -Version 1.2.0
<PackageReference Include="J4asper.DSharpPlus.BetterPagination" Version="1.2.0" />
<PackageVersion Include="J4asper.DSharpPlus.BetterPagination" Version="1.2.0" />Directory.Packages.props
<PackageReference Include="J4asper.DSharpPlus.BetterPagination" />Project file
paket add J4asper.DSharpPlus.BetterPagination --version 1.2.0
#r "nuget: J4asper.DSharpPlus.BetterPagination, 1.2.0"
#:package J4asper.DSharpPlus.BetterPagination@1.2.0
#addin nuget:?package=J4asper.DSharpPlus.BetterPagination&version=1.2.0Install as a Cake Addin
#tool nuget:?package=J4asper.DSharpPlus.BetterPagination&version=1.2.0Install as a Cake Tool
This NuGet package provides an enhanced pagination experience for DSharpPlus, offering a better visual interface for navigating between paginated content.
👁 NuGet Version
👁 NuGet Downloads
To install the package, open the terminal in your project and run the following command, replacing 1.0.0 with the latest version:
dotnet add package J4asper.DSharpPlus.BetterPagination --version 1.0.0
Alternatively, you can search for J4asper.DSharpPlus.BetterPagination in your IDE’s NuGet Package Manager.
To build the package from source, follow these steps:
Clone the repository:
git clone https://github.com/j4asper/DSharpPlus.BetterPagination.git
In your project’s .csproj file, add the following reference:
<ProjectReference Include="../DSharpPlus.BetterPagination/DSharpPlus.BetterPagination/DSharpPlus.BetterPagination.csproj" />
This package adds an extension method, SendBetterPaginatedMessageAsync, to the SlashCommandContext class, enabling easy pagination in your bot commands.
commandContext (SlashCommandContext):
The context of the slash command invocation, containing user information and the interaction context. This is required to send the initial response and track the user interaction.
More info on SlashCommandContext
pages (IReadOnlyList<Page>):
A read-only list of Page objects. Each Page object contains the embed and optional components (buttons, select menus, etc.) to be displayed on a specific page of the paginated message. The content of each page is encapsulated in the Page object.
additionalComponents (IReadOnlyList<DiscordComponent>?, optional):
Optional additional components (e.g., buttons, select menus) that can be added to the message. This can be used to add custom interactive elements like menus, or other buttons. Default is null.
asEphemeral (bool, optional):
A flag indicating whether the paginated message should be sent as an ephemeral message. If set to true, the message will only be visible to the user who invoked the command. Default is false.
allowUsageByAnyone (bool, optional):
A flag indicating whether any user can interact with the pagination buttons, or if the interaction should be restricted to the invoking user only. If set to false, only the user who invoked the command will be able to interact with the buttons. Default is false.
Here’s an example of how to use the package to send a paginated message within a command:
[Command("example")]
[Description("This is a paginated example command")]
public async ValueTask PaginatedExampleCommand(SlashCommandContext context)
{
var embedPageOne = new DiscordEmbedBuilder()
.WithDescription("This is page 1");
var embedPageTwo = new DiscordEmbedBuilder()
.WithDescription("This is page 2");
List<Page> pages =
[
new() { Embed = embedPageOne },
new() { Embed = embedPageTwo, Content = "Text content in message" }
];
// Send the paginated message
await context.SendBetterPaginatedMessageAsync(pages);
}
In this example:
DiscordEmbedBuilder, each with different content.List<Page>, which is passed to the SendBetterPaginatedMessageAsync method to send a paginated message.Example of paginated message with 4 pages and an additional button.
My Open-Source bot KanbanCord uses this extension for pagination. Usage of it can be found here and here.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.