summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
m---------joblib0
-rw-r--r--main.py38
2 files changed, 15 insertions, 23 deletions
diff --git a/joblib b/joblib
-Subproject 542df395ce186ccc28d2c4122b7b12024ade8f4
+Subproject 7ced841aa44a7dd7bd2d3a68ceb989ef488ce44
diff --git a/main.py b/main.py
index f46fa73..2f5d733 100644
--- a/main.py
+++ b/main.py
@@ -57,31 +57,9 @@ async def on_ready():
name="alpha.vainsocial.com"))
-@bot.event
-async def on_command_error(error, ctx):
- logging.error(error)
- if ctx.invoked_subcommand:
- pages = bot.formatter.format_help_for(
- ctx, ctx.invoked_subcommand)
- for page in pages:
- await bot.send_message(
- ctx.message.channel, page)
- else:
- pages = bot.formatter.format_help_for(
- ctx, ctx.command)
- for page in pages:
- await bot.send_message(
- ctx.message.channel, page)
-
-
@bot.command()
-async def vainsocial(name: str, region: str):
+async def vainsocial(name: str, region: str = None):
"""Retrieves a player's stats."""
- region = region.lower()
- if region not in ["na", "eu", "sg", "ea", "sa"]:
- await bot.say("That region is not supported.")
- return
-
query = """
SELECT
player.name,
@@ -153,6 +131,20 @@ async def vainsocial(name: str, region: str):
lmcd = data["last_match_created_date"]
msgid = await bot.say(embed=emb(data))
+ if not in_cache:
+ if region is None:
+ await bot.edit_message(msgid,
+ "Can't find you. What is your region?")
+ return
+ region = region.lower()
+ if region not in ["na", "eu", "sg", "ea", "sa"]:
+ await bot.edit_message(msgid,
+ "That region is not supported.")
+ return
+ else:
+ if region is None:
+ region = data["shard_id"]
+
logging.info("'%s' cached: %s", name, in_cache)
payload = {