Try/Catch on page int

This commit is contained in:
ReperakPro 2021-01-16 12:40:10 -06:00
parent efb17b64d5
commit df456e5d3e

View file

@ -18,10 +18,18 @@ class Help(commands.Cog):
title = 'Help Command' title = 'Help Command'
colour = 0x00FF00 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_count = math.ceil(len(cog_list) / 4)
try:
page = int(page) page = int(page)
except Exception as e:
em = discord.Embed(
title = 'Command error'
colour = 0xFF0000
description = e
)
if page > page_count or page < 1: if page > page_count or page < 1:
await ctx.send(f'Page number \'{page}\' not found.') await ctx.send(f'Page number \'{page}\' not found.')
return return