Skip to content
This repository was archived by the owner on Dec 10, 2022. It is now read-only.

Commit 65d0bfc

Browse files
authored
Added Union acceptance for context/interaction
1 parent be4d6c4 commit 65d0bfc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Paginator.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import discord
2+
import typing
23
from discord.ext import commands
34

45

@@ -40,7 +41,11 @@ def __init__(self, *,
4041

4142
super().__init__(timeout=timeout)
4243

43-
async def start(self, ctx: commands.Context, pages: list[discord.Embed]):
44+
async def start(self, ctx: typing.Union[discord.Interaction, commands.Context], pages: list[discord.Embed]):
45+
46+
if isinstance(ctx, discord.Interaction):
47+
ctx = await commands.Context.from_interaction(ctx)
48+
4449
self.pages = pages
4550
self.total_page_count = len(pages)
4651
self.ctx = ctx

0 commit comments

Comments
 (0)