Skip to content

Commit

Permalink
Add a start_dm option to SimpleMenu (Cog-Creators#6286)
Browse files Browse the repository at this point in the history
Co-authored-by: Jakub Kuczys <[email protected]>
  • Loading branch information
2 people authored and Dav-Git committed Sep 8, 2024
1 parent 3d6cd4e commit cc3641f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions redbot/core/utils/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit cc3641f

Please sign in to comment.