from discord.ext import commands from re import match from lib.parse_data import * @commands.command() async def ping(ctx): await ctx.send('pong') @commands.command() async def report(ctx, arg): if(arg): # update_data() if(arg.upper() == 'KEYS'): await ctx.send(covid_db.keys()) else: 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 await ctx.send(get_top_data(num)) def add_commands(bot): bot.add_command(ping) bot.add_command(report) bot.add_command(top)