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

Commit b079017

Browse files
authored
Merge pull request #8 from SZOKOZ/patch-1
Typing update for Python3.8 and above, Ephemeral messages.
2 parents 7e4e80e + 23e872f commit b079017

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/Paginator.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
from __future__ import annotations
2+
13
import discord
2-
import typing
34
from discord.ext import commands
45

56

@@ -26,11 +27,13 @@ def __init__(self, *,
2627
PreviousButton: discord.ui.Button = discord.ui.Button(emoji=discord.PartialEmoji(name="\U000025c0")),
2728
NextButton: discord.ui.Button = discord.ui.Button(emoji=discord.PartialEmoji(name="\U000025b6")),
2829
PageCounterStyle: discord.ButtonStyle = discord.ButtonStyle.grey,
29-
InitialPage: int = 0) -> None:
30+
InitialPage: int = 0,
31+
ephemeral: bool = False) -> None:
3032
self.PreviousButton = PreviousButton
3133
self.NextButton = NextButton
3234
self.PageCounterStyle = PageCounterStyle
3335
self.InitialPage = InitialPage
36+
self.ephemeral = ephemeral
3437

3538
self.pages = None
3639
self.ctx = None
@@ -41,7 +44,7 @@ def __init__(self, *,
4144

4245
super().__init__(timeout=timeout)
4346

44-
async def start(self, ctx: typing.Union[discord.Interaction, commands.Context], pages: list[discord.Embed], **kwargs):
47+
async def start(self, ctx: discord.Interaction|commands.Context, pages: list[discord.Embed]):
4548

4649
if isinstance(ctx, discord.Interaction):
4750
ctx = await commands.Context.from_interaction(ctx)
@@ -62,7 +65,7 @@ async def start(self, ctx: typing.Union[discord.Interaction, commands.Context],
6265
self.add_item(self.page_counter)
6366
self.add_item(self.NextButton)
6467

65-
self.message = await ctx.send(embed=self.pages[self.InitialPage], view=self, **kwargs)
68+
self.message = await ctx.send(embed=self.pages[self.InitialPage], view=self, ephemeral=self.ephemeral)
6669

6770
async def previous(self):
6871
if self.current_page == 0:

0 commit comments

Comments
 (0)