Dennis.DSharpPlus.PaginatedSelects
1.0.0
dotnet add package Dennis.DSharpPlus.PaginatedSelects --version 1.0.0
NuGet\Install-Package Dennis.DSharpPlus.PaginatedSelects -Version 1.0.0
<PackageReference Include="Dennis.DSharpPlus.PaginatedSelects" Version="1.0.0" />
paket add Dennis.DSharpPlus.PaginatedSelects --version 1.0.0
#r "nuget: Dennis.DSharpPlus.PaginatedSelects, 1.0.0"
// Install Dennis.DSharpPlus.PaginatedSelects as a Cake Addin #addin nuget:?package=Dennis.DSharpPlus.PaginatedSelects&version=1.0.0 // Install Dennis.DSharpPlus.PaginatedSelects as a Cake Tool #tool nuget:?package=Dennis.DSharpPlus.PaginatedSelects&version=1.0.0
Paginated Selects
This extension adds paginated select components to DSharpPlus. (badly)
How to use
First, activate the extension on your discord client
using DSharpPlus.PaginatedSelects;
var paginatedExtension = client.UsePaginatedSelects();
Creating a paginated select
- Using AddPaginatedSelect
PaginatedSelect paginated = new PaginatedSelect(/* List<DiscordSelectComponentOption> here */);
// OR
var normalSelect = new DiscordSelectComponent()
{
// bla bla
};
var paginated = normalSelect.ToPaginatedSelect();
DiscordSelectComponent firstPage = paginatedExtension.AddPaginatedSelect("myselect", paginated);
- Using the extension methods on builders (
DiscordInteractionResponseBuilder
,DiscordFollowupMessageBuilder
,DiscordWebhookBuilder
)
// For paginated selects that was already created:
await ctx.EditResponseAsync(new DiscordWebhookBuilder()
.WithContent("Hi! Where are you from?")
.AddPaginatedSelect("myselect"));
// To create a new one:
await ctx.EditResponseAsync(new DiscordWebhookBuilder()
.WithContent("Hi! Where are you from?")
.AddPaginatedSelect("myselect", new PaginatedSelect(new(){
new("America", "us"),
new("France", "fr"),
new("Germany", "gb"),
new("Turkey", "shit"),
// ...
})));
// Note: you can also make a DiscordSelectComponent and supply it, the extension will call ToPaginatedSelect() on it.
I want it gone after its used
// For this paginated select:
new PaginatedSelect()
{
AutoRemoveSelect = true,
};
// For all of the selects (that doesnt set PaginatedSelect#AutoRemoveSelect to false)
new PaginatedSelectsConfiguration()
{
AutoRemoveSelect = true,
};
I want the other contents of the message changed after the page changes
Sure! (do it yourself)
new PaginatedSelect()
{
CustomRender = (CustomRenderContext ctx) => {
ctx.Interaction.DoStuff();
// Note: you must supply the select component too
// You can use pre-made ctx.Select and PaginatedSelectsExtension.Utils.ReplaceComponent ;)
}
};
Want more?
This extension is highly configurable. You can set a default placeholder text for your selects (PaginatedSelectsConfiguration
)
and override them per-select. (PaginatedSelect
)
You can also change the next and previous page select options in the configuration.
new PaginatedSelectsConfiguration()
{
NextPageOption = new("NEXTTTT!!", "_", "next page uwu"),
PreviousPageOption = new("fuck go back", "_", "oh god did i go too far"),
};
Pull requests and issues are welcome (please)
Formatting
The label, description and the placeholder/suffix in the configuration allow for custom formatting.
{page}
will turn into the page number{pagecount}
will turn into the total number of pages
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- DSharpPlus (>= 4.3.0-nightly-01134)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 270 | 5/28/2022 |