34 lines
698 B
Python
34 lines
698 B
Python
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):
|
|
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)
|