diff --git a/database.py b/database.py index a7656bb..0a19f67 100644 --- a/database.py +++ b/database.py @@ -42,7 +42,6 @@ def get_soulscream(username): try: cachetime = datetime.datetime.fromisoformat(scream[3]) - print(datetime.datetime.now(datetime.timezone.utc) - cachetime) if datetime.datetime.now(datetime.timezone.utc) - cachetime >= datetime.timedelta(days = 7): #delete old cache c.execute("DELETE FROM soulscreams WHERE name=?", (username,)) diff --git a/onomancer.py b/onomancer.py index 7e318cb..7d3162d 100644 --- a/onomancer.py +++ b/onomancer.py @@ -1,12 +1,11 @@ #interfaces with onomancer -import requests -import json +import requests, json, urllib import database as db onomancer_url = "https://onomancer.sibr.dev/api/" -name_stats_hook = "generateStats/" +name_stats_hook = "generateStats2?name=" def get_stats(username): #check database for cached name first @@ -15,8 +14,7 @@ def get_stats(username): return scream #yell at onomancer if not in cache or too old - response = requests.get(onomancer_url + name_stats_hook + username) - print("yelled at onomancer") + response = requests.get(onomancer_url + name_stats_hook + urllib.parse.quote_plus(username)) if response.status_code == 200: db.cache_soulscream(username, response.json()["soulscream"]) return response.json()["soulscream"] \ No newline at end of file diff --git a/the_prestige.py b/the_prestige.py index 782cb38..42961cd 100644 --- a/the_prestige.py +++ b/the_prestige.py @@ -35,7 +35,6 @@ async def on_message(msg): if msg.content.startswith(prefix): command_b = True command = msg.content.split(prefix, 1)[1] - print(command) if not command_b: return @@ -45,7 +44,7 @@ async def on_message(msg): elif msg.channel.id == config()["soulscream channel id"]: try: await msg.channel.send(ono.get_stats(msg.author.nick)) - except TypeError: + except TypeError or AttributeError: await msg.channel.send(ono.get_stats(msg.author.name)) elif command == "credit":