# TODO: work on this

@@ -1,21 +1,3353 @@
-# TODO: work on this
+import discord%0Aimport typing%0Aimport asyncio%0A%0A%0Aclass Paginator:%0A    def __init__(self, client: discord.Client, message: discord.Message, predicate, pages: typing.Iterable,%0A                 *, embed=None, timeout=60, delete_message=False):%0A        if message.author.id != client.user.id:%0A            raise RuntimeError('Cannot use message the client doesn%5C't own as pagination message.')%0A%0A        self.client = client%0A        self.pages = list(pages)%0A        self.predicate = predicate%0A        self.timeout = timeout%0A        self.message = message%0A        self.delete_msg = delete_message%0A        self.stopped = False%0A%0A        self.navigation = %7B%0A            '%5CN%7BBLACK LEFT-POINTING DOUBLE TRIANGLE WITH VERTICAL BAR%7D': self.first_page,%0A            '%5CN%7BBLACK LEFT-POINTING TRIANGLE%7D': self.previous_page,%0A            '%5CN%7BBLACK RIGHT-POINTING TRIANGLE%7D': self.next_page,%0A            '%5CN%7BBLACK RIGHT-POINTING DOUBLE TRIANGLE WITH VERTICAL BAR%7D': self.last_page,%0A            '%5CN%7BBLACK SQUARE FOR STOP%7D': self.stop%0A        %7D%0A        self.embed = discord.Embed(description='Please wait, pages are loading...') if embed is None else embed%0A%0A        self._page = None%0A%0A    async def begin(self):%0A        %22%22%22Starts pagination%22%22%22%0A        await self.message.edit(embed=self.embed)%0A        for button in self.navigation:%0A            await self.message.add_reaction(button)%0A        await self.first_page()%0A        while not self.stopped:%0A            try:%0A                reaction, user = await self.client.wait_for('reaction_add', check=self.predicate, timeout=self.timeout)%0A            except asyncio.TimeoutError:%0A                await self.stop(delete=False)%0A                continue%0A%0A            reaction = reaction.emoji%0A%0A            if reaction not in self.navigation:%0A                continue  # not worth our time%0A%0A            try:%0A                await self.message.remove_reaction(reaction, user)%0A            except discord.Forbidden:%0A                pass  # oh well, we tried%0A%0A            await self.navigation%5Breaction%5D()%0A%0A    async def stop(self, *, delete=None):%0A        %22%22%22Aborts pagination.%22%22%22%0A        if delete is None:%0A            delete = self.delete_msg%0A%0A        if delete:%0A            await self.message.delete()%0A        else:%0A            await self._clear_reactions()%0A        self.stopped = True%0A%0A    async def _clear_reactions(self):%0A        try:%0A            await self.message.clear_reactions()%0A        except discord.Forbidden:%0A            for button in self.navigation:%0A                await self.message.remove_reaction(button, self.message.author)%0A%0A    async def format_page(self):%0A        self.embed.description = self.pages%5Bself._page%5D%0A        self.embed.set_footer(text='Page %7B%7D of %7B%7D'.format(self._page+1, len(self.pages)))%0A        await self.message.edit(embed=self.embed)%0A%0A    async def first_page(self):%0A        self._page = 0%0A        await self.format_page()%0A%0A    async def next_page(self):%0A        self._page += 1%0A        if self._page == len(self.pages):  # avoid the inevitable IndexError%0A            self._page = 0%0A        await self.format_page()%0A%0A    async def previous_page(self):%0A        self._page -= 1%0A        if self._page %3C 0:  # ditto%0A            self._page = len(self.pages) - 1%0A        await self.format_page()%0A%0A    async def last_page(self):%0A        self._page = len(self.pages) - 1%0A        await self.format_page()
 %0A

Add paginator