Support context menus
See original GitHub issueSummary
Be able to create context menus & listen for them properly
What is the feature request for?
The core library
The Problem
Having a way for users to create and listen for the new context menus natively.
The Ideal Solution
The context menus are somewhat similiar to buttons, and should be created in the same way, if possible.
- Like buttons, context menus are very easily created, even more so than buttons. You can create a simple one with a 2 line POST request. The decorator interface like we have for
discord.ui.button
could work pretty well for this. The decorator would decorate the callback, and said callback is called when the specific interaction is recieved. - Buttons also allow for subclassing, which could also be done here. Subclass a
ContextMenu
class or something of that sort. The subclass will also have an overrideable callback class, just like the button class.
The Current Solution
I’ve managed to get it to work by doing the following:
- Manually registering the command either using
aiohttp
, or some other way. - Using
on_interaction
to listen for incoming interactions, and getting interaction data usinginteraction.data
as the given attributes for interactions won’t always work since the layout of the returned json from Discord is slightly different.
Additional Context
I believe this shouldn’t be too hard to implement, consider it is very similar to buttons, and those were added relatively quickly to the library.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:16
- Comments:6 (3 by maintainers)
Top Results From Across the Web
"contextmenu" | Can I use... Support tables for HTML5, CSS3, etc
"Can I use" provides up-to-date browser support tables for support of front-end web technologies on desktop and mobile web browsers.
Read more >chrome.contextMenus - Chrome Developers
Use the chrome.contextMenus API to add items to Google Chrome's context menu. You can choose what types of objects your context menu additions...
Read more >Context menu items - Mozilla - MDN Web Docs
The full list of supported contexts is available at menus.ContextType and includes contexts outside of a web page, such as bookmark items in...
Read more >Context menus - Components - Human Interface Guidelines
A context menu provides access to functionality that's directly related to an onscreen item, without cluttering the interface.
Read more >Support legacy context menus for packaged apps
The context menu is one of the most popular and useful shell extensions. If you are already in File Explorer or on the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Well well, it’s already in the D.py 2.0 atm 😅
It has already been implemented @itttgg