From 409ece427f9b8014cf0f28ff03a019cab323107e Mon Sep 17 00:00:00 2001 From: yeetbruises <61666396+yeetbruises@users.noreply.github.com> Date: Sun, 14 Jan 2024 22:17:19 -0500 Subject: [PATCH] Add a start_dm option to SimpleMenu (#6286) Co-authored-by: Jakub Kuczys --- redbot/core/utils/views.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/redbot/core/utils/views.py b/redbot/core/utils/views.py index 10c1f23ecab..f6d2fea48a1 100644 --- a/redbot/core/utils/views.py +++ b/redbot/core/utils/views.py @@ -242,6 +242,19 @@ async def start(self, ctx: Context, *, ephemeral: bool = False): kwargs = await self.get_page(self.current_page) self.message = await ctx.send(**kwargs, ephemeral=ephemeral) + async def start_dm(self, user: discord.User): + """ + Used to start displaying the menu in a direct message. + + Parameters + ---------- + user: `discord.User` + The user that will be direct messaged by the bot. + """ + self.author = user + kwargs = await self.get_page(self.current_page) + self.message = await user.send(**kwargs) + async def get_page(self, page_num: int) -> Dict[str, Optional[Any]]: try: page = await self.source.get_page(page_num)