from discord.ext import commands from lib.parse_data import get_covid_data, get_top_data @commands.command() async def ping(ctx): await ctx.send('pong') @commands.command() async def report(ctx, arg): if(arg): print('Got command.') try: await ctx.send(get_covid_data(arg.upper())) except Exception as e: await ctx.send(f'{e}') @commands.command() async def top(ctx, arg='5'): try: num = int(arg) except Exception as e: await ctx.send(f'{arg} isn\'t a number.') return try: await ctx.send(get_top_data(num)) except Exception as e: await ctx.send(f'{e}') def add_commands(bot): bot.add_command(ping) bot.add_command(report) bot.add_command(top)