From ae60ef5eed98c2efebd26d901e08b47176fdf0fc Mon Sep 17 00:00:00 2001 From: Phxntxm Date: Sat, 22 Jul 2017 16:42:29 -0500 Subject: [PATCH] Paginate the first 5 definitions --- cogs/links.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cogs/links.py b/cogs/links.py index 70eb71b..56002d3 100644 --- a/cogs/links.py +++ b/cogs/links.py @@ -169,7 +169,12 @@ class Links: await ctx.send("No result with that term!") # If the list is not empty, use the first result and print it's defintion else: - await ctx.send(data['list'][0]['definition']) + entries = [x['definition'] for x in data['list']] + try: + pages = utils.Pages(self.bot, message=ctx.message, entries=entries[:5]) + await pages.paginate() + except utils.CannotPaginate as e: + await ctx.send(str(e)) # Urban dictionary has some long definitions, some might not be able to be sent except discord.HTTPException: await ctx.send('```\nError: Definition is too long for me to send```')