diff --git a/redbot/core/utils/views.py b/redbot/core/utils/views.py index aff3f11e1..f70c55650 100644 --- a/redbot/core/utils/views.py +++ b/redbot/core/utils/views.py @@ -107,6 +107,17 @@ class SimpleMenu(discord.ui.View): under the select menu in this instance. 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 -------- You can provide a list of strings:: @@ -269,6 +280,11 @@ class SimpleMenu(discord.ui.View): Send the message ephemerally. This only works 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 if user is not None: self.author = user @@ -285,6 +301,11 @@ class SimpleMenu(discord.ui.View): user: `discord.User` 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 kwargs = await self.get_page(self.current_page) self.message = await user.send(**kwargs)