adjust Book

release-1.0.0
DustyP 8 years ago
parent 762984592b
commit 3700ab2344

@ -209,16 +209,16 @@ class Paginator:
class Book: class Book:
def __init__(self, pag: Paginator, ctx: discord.ext.commands.Context): def __init__(self, pag: Paginator, ctx: typing.Tuple[discord.Message,
discord.TextChannel,
discord.ext.commands.Bot]):
if pag == Paginator(): if pag == Paginator():
raise RuntimeError('Cannot create a book out of an empty Paginator.') raise RuntimeError('Cannot create a book out of an empty Paginator.')
self._pages = pag.pages() self._pages = pag.pages()
self._len_pages = len(self._pages) self._len_pages = len(self._pages)
self._current_page = 0 self._current_page = 0
self._message = ctx.message self._message, self._channel, self._bot = ctx
self._channel = ctx.channel
self._bot = ctx.bot
self._locked = True self._locked = True
def advance_page(self, count: int=1): def advance_page(self, count: int=1):
@ -240,11 +240,11 @@ class Book:
if not self._current_page < 10: if not self._current_page < 10:
await self._message.add_reaction(self._bot.unicode_emojis['rewind']) await self._message.add_reaction(self._bot.unicode_emojis['rewind'])
if not self._current_page == 0: if not self._current_page == 0:
await self._message.add_reaction(self.bot.unicode_emojis['back']) await self._message.add_reaction(self._bot.unicode_emojis['back'])
if self._len_pages > 1: if self._len_pages > 1:
await self._message.add_reaction(self.bot.unicode_emojis['hash']) await self._message.add_reaction(self._bot.unicode_emojis['hash'])
if not self._current_page == self._len_pages - 1: if not self._current_page == self._len_pages - 1:
await self._message.add_reaction(self.bot.unicode_emojis['forward']) await self._message.add_reaction(self._bot.unicode_emojis['forward'])
if not self._current_page > self._len_pages - 11: if not self._current_page > self._len_pages - 11:
await self._message.add_reaction(self._bot.unicode_emojis['fast_forward']) await self._message.add_reaction(self._bot.unicode_emojis['fast_forward'])
if not self._current_page == self._len_pages - 1: if not self._current_page == self._len_pages - 1:

Loading…
Cancel
Save