Skip to content

Conversation

@onerandomusername
Copy link
Contributor

@onerandomusername onerandomusername commented Aug 16, 2021

Relevant Issues

Closes #49

Description

  • feat: add button pagination

@onerandomusername onerandomusername added a: bot l: intermediate p: normal Normal Priority s: approved The issue has received a maintainer's approval s: WIP Waiting for author to address a review or respond to a comment t: feature Relating to the functionality of the application. labels Aug 16, 2021
@onerandomusername onerandomusername self-assigned this Aug 16, 2021
@codecov
Copy link

codecov bot commented Aug 16, 2021

Codecov Report

Merging #50 (435da8f) into main (50f164b) will decrease coverage by 0.80%.
The diff coverage is 35.42%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #50      +/-   ##
==========================================
- Coverage   39.42%   38.62%   -0.81%     
==========================================
  Files          13       16       +3     
  Lines         596      769     +173     
  Branches       70      105      +35     
==========================================
+ Hits          235      297      +62     
- Misses        354      459     +105     
- Partials        7       13       +6     
Impacted Files Coverage Δ
modmail/extensions/extension_manager.py 0.00% <0.00%> (ø)
modmail/extensions/plugin_manager.py 0.00% <0.00%> (ø)
modmail/extensions/utils/paginator_manager.py 0.00% <0.00%> (ø)
modmail/utils/pagination.py 42.96% <42.96%> (ø)
modmail/utils/errors.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 50f164b...435da8f. Read the comment docs.

previous pagination system with dislash had so many bugs,
many of them caused by dislash itself.
I've adapted the pagination system from khk4912/EZPaginator and
converted it to using button interactions.

Nearly all that is left to do is make the paginator pretty with embeds.
use a dict instead of two lists to store pagination states
set up color changing depending on enabled vs disabled
remove a bunch of duplicated code
switch to characters instead of emojis for pagination labels
after internal deliberation, we've updated the pagination icons to
be a bit more explantative of what each one does.
@onerandomusername onerandomusername marked this pull request as ready for review August 19, 2021 17:57
@onerandomusername
Copy link
Contributor Author

While this doesn't subclass the discord.py Paginator, I've been contemplating later implementing the Paginator
when we write our custom help command. This is because the help command uses the Paginator to display the help
information, but I don't exactly want to mixin the Paginator into this paginator.

If someone wants to implement the discord.py Paginator as a mixin to this paginator, I'll happily add it.

@onerandomusername
Copy link
Contributor Author

Went for it, just integrated the discordpy Paginator into the Button Paginator. Still needs some features added (specifically embeds) and maybe touched up a bit, but other than that, looks pretty good.

@Shivansh-007 Shivansh-007 added s: needs review Ready for review and merge and removed s: WIP Waiting for author to address a review or respond to a comment s: approved The issue has received a maintainer's approval labels Aug 30, 2021
@onerandomusername
Copy link
Contributor Author

@bast0006 Part 2?

@onerandomusername onerandomusername merged commit 0a329ff into main Aug 31, 2021
@onerandomusername onerandomusername deleted the feat/paginator branch August 31, 2021 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

l: intermediate p: normal Normal Priority s: needs review Ready for review and merge t: feature Relating to the functionality of the application.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Menu Pagination

4 participants