Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <me@jacken.men>
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
@@ -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)

0 comments on commit cc3641f

Please sign in to comment.