Rapptz / discord-ext-menus

MIT License
234 stars 87 forks source link

Menus wont load unless I explicitly ask for the page first #16

Open TurnrDev opened 4 years ago

TurnrDev commented 4 years ago

This is my code:

        embeds = LeaderboardPages(leaderboard, per_page=10, base=emb, emoji=self.emoji, stat=stat)

        menu = menus.MenuPages(
            source=embeds, timeout=300.0, message=message, clear_reactions_after=True,
        )
        await menu.show_page(0)
        await menu.start(ctx)

I followed the code example in README.md for AsyncIteratorPageSource and it says to simply call the Menu Pages object and the await menu.start(ctx) but any time I did that I had an empty response. Seems I needed to call await menu.show_page(0) first

TurnrDev commented 4 years ago

After thurther investgation, the issue only seems to happen when message has been declared on the init for MenuPages.

Rapptz commented 4 years ago

Unfortunately this one is a bit rough to fix. Per the implementation as it stands, send_initial_message isn't called if a message is already supplied. For Menu that works okay but for MenuPages that means that it's never called and thus the page isn't shown.

TurnrDev commented 4 years ago

I've added a note in README about this exact issue (PR #17) - It's not a bug fix but it's better than nothing :)