Define view once inside menus.menu for button menus (#6472)

This commit is contained in:
Kyla 2024-11-17 19:54:30 +03:30 committed by GitHub
parent 30058c0f73
commit 2871992772
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -212,13 +212,12 @@ async def menu(
# where the original message is already sent prior to starting. # where the original message is already sent prior to starting.
# This is not normally the way we recommend sending this because # This is not normally the way we recommend sending this because
# internally we already include the emojis we expect. # internally we already include the emojis we expect.
if controls == DEFAULT_CONTROLS:
view = SimpleMenu(pages, timeout=timeout) view = SimpleMenu(pages, timeout=timeout)
if controls == DEFAULT_CONTROLS:
await view.start(ctx, user=user) await view.start(ctx, user=user)
await view.wait() await view.wait()
return return
else: else:
view = SimpleMenu(pages, timeout=timeout)
view.remove_item(view.last_button) view.remove_item(view.last_button)
view.remove_item(view.first_button) view.remove_item(view.first_button)
has_next = False has_next = False