nextcord / nextcord-ext-menus

A nextcord menu and pagination extension that makes working with reaction menus and button component menus a bit easier
https://menus.docs.nextcord.dev
MIT License
26 stars 9 forks source link

fix: Clear buttons before sending if one page async iterator source #39

Closed DenverCoder1 closed 2 years ago

DenverCoder1 commented 2 years ago

Summary

There is a small issue with AsyncIterator page sources where if a menu requires only 1 page, the buttons will be created but then removed within a second. This happens because is_paginating is not able to determine if more than 1 page is needed until the first page is read. This will also apply to any custom page sources where the former applies. Currently the buttons are cleared in start(), after the menu has been sent.

This PR makes it so that the buttons are removed from the view after the page is read, but before it is sent so that it doesn't need to be edited afterwards.

Additionally, ButtonMenu.clear() was updated to only remove nextcord.ui.Button objects. This was done since it is what is already written in the docstring and is consistent with disable() and enable().

Changes

Potentially breaking

Gifs

Before old
After old