#Pagination with buttons and embeds!

1 messages · Page 1 of 1 (latest)

junior aspen
#

I want to implement pagination for my app, I have mediator services registered so all I need is to request the page and filter per the amount per page. But how would I do this with D# and buttons on an embed?

#

ping on reply pls, i dont always have this post opened

hard oracle
#

We have an open PR for that one that only lacks testing afaik

#

##1967

mystic pondBOT
prime karmaBOT
#

🏷 use pr artifacts:

To run the library off a pull request, you will need a GitHub account. Navigate to the pull request you want to use and click on the green check mark next to the latest commit: https://cdn.discordapp.com/attachments/379379415475552276/1075485948281888788/image.png

Then, go to "Details" and scroll all the way down to "Artifacts". Download the zip file and extract it into a folder of your choice.

Now, you need to add the packages to your project.

Using CLI:

Run dotnet add package <package-name> --source "path/to/your/package/folder"

Using Visual Studio:

Add your local folder as a package source in this dialog, reached through the little gear icon in your NuGet dialogue, see https://cdn.discordapp.com/attachments/959804202744422453/962070642432311366/unknown.png and https://cdn.discordapp.com/attachments/959804202744422453/962070737148051536/unknown.png. You'll want to click the plus icon to create a new package source, then enter your folder name at "Source".

Using your .csproj file:

(do not.)
Add <RestoreAdditionalPackageSources>path/to/your/package/folder</RestoreAdditionalPackageSources> to your head PropertyGroup.

In the latter two cases, you should then be able to update D#+ to the pull request build through your NuGet dialogue.

junior aspen
junior aspen
hard oracle
#

install DSP.interacitvity if you havent and then theres a SendPaginatedMessage method on DiscordChannel

junior aspen
#

ou okay

hard oracle
junior aspen
#

i seee

#

thanks

#

hmm

#

i dont think this will be useful for me, as fetching each page is an asynchronous operation, and i do not know how many pages there may be ahead of time, so passing an IEnumerable<Page> just wont be a solution for me, i think i may have to implement pagination myself, with buttons and so on

#

Lets say I have this method to fetch each page

static async Task<IEnumerable<Item>> FetchItems(int page)
{
  var query = new GetAllItemsQuery(page, 5);
  return await mediator.Send(query);
}
hard oracle
#

Well our paginator enumerates it when you send the message so still not really functions

#

i have plans to rework our pagination

junior aspen
#

thats gooooddd ill take a look at the current implementation and make something, ill share it with you

hard oracle
#

oh i have started my rework and im explicitly not looking at the old one when