-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[V3 Utils] Menu system #1566
[V3 Utils] Menu system #1566
Conversation
redbot/core/utils/menus.py
Outdated
except discord.NotFound: | ||
pass | ||
if page == len(pages) - 1: | ||
next_page = 0 # Loop around to the first item |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uses next_page
as variable and next_page
and function
It appears multiple instances of a menu will trigger each other's button presses. |
Upvote |
redbot/core/utils/menus.py
Outdated
await message.edit(content=current_page) | ||
|
||
def react_check(r, u): | ||
return u == ctx.author and str(r.emoji) in controls.keys() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add and r.message==message
redbot/core/utils/menus.py
Outdated
|
||
DEFAULT_CONTROLS = { | ||
"➡": next_page, | ||
"⬅": prev_page, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Swap order of next_page
and prev_page
for clearer buttons
…-DiscordBot into V3/enhancement/menu_system
Type
Description of the changes
This is a possible implementation for a menu system. Basically, cog devs can pass in context, a list of either strings or embeds and a dict mapping of emoji to functions and the user will get a menu controlled by emoji. An example:
will yield a menu where users can change pages and close the menu
DEFAULT_CONTROLS
is basically a quick way to use the menu system if cog devs are fine using some default functions to handle menu controls (basically, these are a function to move to the next page, a function to move to the previous page, and a function to close the menu (deleting the message that is the menu))