Dpymenus

Latest version: v2.1.5

Safety actively analyzes 627119 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 3 of 4

1.2.0

Not secure
Changed

- Dropped support for discord.py versions < 1.5 due to mandatory breaking changes with the Discord API and the new
Intents system. This is a forced change as of October 7th. You can read more
[here](https://discordpy.readthedocs.io/en/latest/intents.html#intents-primer).

1.1.0

Not secure
Changed

- Fixed a bug where bot reactions were being captured by the menu event loop when using the raw reaction event API.
- All raised errors are now caught and logged appropriately.
- Fixed a bug where certain custom Emoji objects would fail as buttons.
- PaginatedMenu & ButtonMenu now refresh their output attr after buttons have been added. This allows them to be
referenced with the `.reactions` value.
- Optimized PaginatedMenu when using default buttons by skipping intensive check paths.
- Optimized PaginatedMenu reaction_add/remove event checks when using default buttons by skipping intensive check
predicate.
- Internal type var `PageEmbed` renamed to `PageType`; added `Dict` type to the new type var.
- Fixed a bug where the bot was counting its own reactions when tallying poll votes.
- Fixed a bug where specific mixes of emoji types would crash a ButtonMenu.
- Fixed a bug where a user applying a non-button reaction to a menu in a ButtonMenu would cause it to reload the page,
forcing all the buttons to be added again.
- Moved the private _is_cancelled method into TextMenus, as it is only called in that class.
- Examples have been updated to showcase any new features.

Added

- Logger added to the library as 'dpymenus'.
- `emoji` added as a dependency for fast, safe unicode emoji lookups, button checks, and conversions.
- PaginatedMenu now does pre-validation on provided buttons.
- The `.add_pages()` method can now take a dictionary-style embeds *(though I do recommend against this unless you're
retrieving JSON data)*.
- Added a new helper method for ButtonMenu styles: `button_pressed` -- this is meant for simplifying the check for which
button was pressed in your `on_next` callbacks. It takes the button you are checking for and returns True when the
button you passed in is the same as what the menus received input was.
- Added a new helper method for TextMenu
styles: `response_is' -- this is meant for simplifying the check for what a user had typed in when building your `
on_next` callbacks. It takes a string or a list of strings and returns True when the text passed in matches what the
user had typed.
- Added a new menu option for TextMenus: `normalize_responses` -- if called on your menu instance, user text responses
will be stripped of whitespace *(incl. leading, trailing, and anything over 2 spaces within)* and lower-cased.
- Internally, added a new TypeVar: `Button` to replace `Union[Emoji, PartialEmoji, str]`.

Removed

- The default cancel page has been removed from all menu styles to align with PaginatedMenus behavior. As these menu
styles define an `on_cancel` callback, users can still add their own in if they wish. This is primarily for
consistency across the library.

1.0.0

This marks the first stable release of dpymenus. As of now, I will not be making any breaking changes to the API without
a major version increase. This release also sees the finalization of the fluent-interface style for building menus, as
well as various bug fixes, stability fixes, stronger error handling and validation, and better customizability for
users.

Changed

- **Breaking:** Menus options are now set via fluent-interface style of programming rather than parameters. The primary
influences for this change was a growing number of options (which meant very long parameter lists) and the benefit of
matching how discord.py builds Embed objects -- this means it is more familiar to users of the library, even if they
aren't completely familiar with that paradigm.
- Sessions are now stored as a dictionary with the keys being a tuple of (user_id, channel_id) now. This is faster for
lookups, and allows the menu reference to be carried outside the current menu, so session limiting is more flexible.
This was primarily changed to allow the new `allow_multisession` option.
- The BaseMenu class now subclasses ABC.
- **Breaking:** The `.cancel()` method on menus is now `.close()`. The reason for this change is convention -- it aligns
with `.open()` better.
- Reactions now use the raw_reaction event API.
- Menus now utilize properties to define their option attributes.
- **Breaking:** Pages now use \_\_slots\_\_ to define their attributes for increases performance / memory usage.
- All examples updated to use the latest features.
- Fixed a bug where `add_pages` would not handle mixed Page and Embed objects gracefully.

Added

- Pages now have an `index` attribute instead of the menu class storing only the current index.
- Improved validation checks for menu errors. Stronger error handling will be a focus of v1.1, however.
- Many new methods for use with menu objects to define their options. See the README section titled 'Menu Options' or
the API documentation for a complete list.

Removed

- **Breaking:** Removed the `.add_page()` method in favor of `.add_pages()` and the new fluent-style. It reduces bot
code, reduces visual noise, and makes it easier to reason about where things happen in your menu with dense or complex
embeds.
- **Breaking:** Removed the `page_index` attribute from `BaseMenu` in favor of each `Page` storing its own index in the
order it was processed in from the `.add_pages()` method. As this takes a list, the order will be safely carried over.
This also allows the user to swap pages simply by changing their order in the menu, and change the menu page order at
runtime.
- **Breaking:** Pages no longer have an `embed` parameter, as they subclass Embed and use internal methods to handle
safe handling and display.
- **Breaking:** All menu and page optional parameters have been removed in favor of methods.
- Inline comment guides in examples have been removed in favor of a small tutorial website that is being worked on.

0.3.5

Not secure
Added

- Menus now accept a `destination` parameter, which takes a User or Channel object. This will open the menu in that
channel as opposed to in the current channel.

Changed

- **Breaking:** Broke the `next` method out into two methods: `next` and `go_to`. `next` no longer takes any
parameters (previously took `name`) to jump to a different page. `go_to` acts the same as the old `next` code, but
takes a `name_or_index` parameter to accurately reflect the change in *0.2.8* where you could jump to indexes as well.
The reason behind this was to simplify the branching code and user readability.
- The default cancelled embed now has the title *'Cancelled'* instead of the last pages title.
- Refactored a lot of older code, particularly the subclasses of BaseMenu.
- Rewrote the README; removed the old usage sections for a simplified *'Getting Started'* section. Added in information
about new features, such as `destinations`.
- Updated to the latest discord.py version: 1.4.1
- Simplified some examples by removing 'fluff' code.

0.3.4

Not secure
Fixed

- Fixed an issue where string-type emoji would not pass a `ButtonMenu`
check.

0.3.3

Not secure
*dpymenus works with Python 3.9 beta.*

Changed

- Moved various checks into standing methods instead of lambdas for caching opportunities.
- Refactored some repeated code paths.

Fixed

- Fixed an issue where adding a custom reaction to a `ButtonMenu` or
`PaginatedMenu` would raise an HTTP 400 and lock the menu.
- Fixed various typos and grammatical errors within the documentation.

Page 3 of 4

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.