From df456e5d3e36105a6e7b74a0a739a5c54fce3612 Mon Sep 17 00:00:00 2001 From: ReperakPro Date: Sat, 16 Jan 2021 12:40:10 -0600 Subject: [PATCH] Try/Catch on page int --- commands/help.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/commands/help.py b/commands/help.py index 35f5a36..0dc0cd6 100644 --- a/commands/help.py +++ b/commands/help.py @@ -18,10 +18,18 @@ class Help(commands.Cog): title = 'Help Command' colour = 0x00FF00 ) - cog_list = [c for c in self.bot.cogs.keys()] + cog_list = [cog_iter for cog_iter in self.bot.cogs.keys()] page_count = math.ceil(len(cog_list) / 4) - page = int(page) + try: + page = int(page) + except Exception as e: + em = discord.Embed( + title = 'Command error' + colour = 0xFF0000 + description = e + ) + if page > page_count or page < 1: await ctx.send(f'Page number \'{page}\' not found.') return