From 9eebb9361d6f5ff3255ffdc6d9efeb2ccb4503e7 Mon Sep 17 00:00:00 2001 From: phxntxm Date: Wed, 13 Jul 2016 21:44:18 -0500 Subject: [PATCH] The lookup for the profile info takes a while, sent a message before it starts --- cogs/overwatch.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cogs/overwatch.py b/cogs/overwatch.py index fa0914a..3ff5ce8 100644 --- a/cogs/overwatch.py +++ b/cogs/overwatch.py @@ -4,6 +4,7 @@ from discord.ext import commands import urllib.parse import urllib.request import urllib.error +import asyncio import json base_url = "https://owapi.net/api/v2/u/" @@ -20,6 +21,7 @@ class Overwatch: @ow.command(pass_context=True, name="add") async def add(self, ctx, username: str): username = username.replace("#", "-") + await self.bot.say("Looking up your profile information....") url = base_url + "{}/stats/general".format(username) try: urllib.request.urlopen(url) @@ -36,7 +38,7 @@ class Overwatch: await self.bot.say("I have updated your saved battletag {}".format(ctx.message.author.mention)) else: cursor.execute('insert into overwatch (id, battletag) values (%s, %s)', (ctx.message.author.id, username)) - await self.bot.say("I have just saved your battletag {}".format(ctx.message.author.id)) + await self.bot.say("I have just saved your battletag {}".format(ctx.message.author.mention)) config.closeConnection() @ow.command(pass_context=True, name="delete", aliases=['remove'])