mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
Add support for SimpleMenu to use custom select options (#6480)
Co-authored-by: Jakub Kuczys <me@jacken.men>
This commit is contained in:
parent
9419f2642a
commit
f4ffc6bc80
@ -107,6 +107,17 @@ class SimpleMenu(discord.ui.View):
|
|||||||
under the select menu in this instance.
|
under the select menu in this instance.
|
||||||
Defaults to False.
|
Defaults to False.
|
||||||
|
|
||||||
|
Attributes
|
||||||
|
----------
|
||||||
|
select_menu: `discord.ui.Select`
|
||||||
|
A select menu with a list of pages. The usage of this attribute is discouraged
|
||||||
|
as it may store different instances throughout the menu's lifetime.
|
||||||
|
|
||||||
|
.. deprecated-removed:: 3.5.14 60
|
||||||
|
Any behaviour enabled by the usage of this attribute should no longer be depended on.
|
||||||
|
If you need this for something and cannot replace it with the other functionality,
|
||||||
|
create an issue on Red's issue tracker.
|
||||||
|
|
||||||
Examples
|
Examples
|
||||||
--------
|
--------
|
||||||
You can provide a list of strings::
|
You can provide a list of strings::
|
||||||
@ -269,6 +280,11 @@ class SimpleMenu(discord.ui.View):
|
|||||||
Send the message ephemerally. This only works
|
Send the message ephemerally. This only works
|
||||||
if the context is from a slash command interaction.
|
if the context is from a slash command interaction.
|
||||||
"""
|
"""
|
||||||
|
if self.use_select_menu and self.source.is_paginating():
|
||||||
|
self.remove_item(self.select_menu)
|
||||||
|
# we added a default one in init so we want to remove it and add any changes here
|
||||||
|
self.select_menu = self._get_select_menu()
|
||||||
|
self.add_item(self.select_menu)
|
||||||
self._fallback_author_to_ctx = True
|
self._fallback_author_to_ctx = True
|
||||||
if user is not None:
|
if user is not None:
|
||||||
self.author = user
|
self.author = user
|
||||||
@ -285,6 +301,11 @@ class SimpleMenu(discord.ui.View):
|
|||||||
user: `discord.User`
|
user: `discord.User`
|
||||||
The user that will be direct messaged by the bot.
|
The user that will be direct messaged by the bot.
|
||||||
"""
|
"""
|
||||||
|
if self.use_select_menu and self.source.is_paginating():
|
||||||
|
self.remove_item(self.select_menu)
|
||||||
|
# we added a default one in init so we want to remove it and add any changes here
|
||||||
|
self.select_menu = self._get_select_menu()
|
||||||
|
self.add_item(self.select_menu)
|
||||||
self.author = user
|
self.author = user
|
||||||
kwargs = await self.get_page(self.current_page)
|
kwargs = await self.get_page(self.current_page)
|
||||||
self.message = await user.send(**kwargs)
|
self.message = await user.send(**kwargs)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user