changed onomancer endpoint to allow for / characters
This commit is contained in:
parent
1be65a16b3
commit
6fd4120b8f
|
@ -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,))
|
||||
|
|
|
@ -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"]
|
|
@ -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
|
||||
|
||||
|
@ -47,6 +46,8 @@ async def on_message(msg):
|
|||
await msg.channel.send(ono.get_stats(msg.author.nick))
|
||||
except TypeError:
|
||||
await msg.channel.send(ono.get_stats(msg.author.name))
|
||||
except AttributeError:
|
||||
await msg.channel.send(ono.get_stats(msg.author.name))
|
||||
|
||||
elif command == "credit":
|
||||
await msg.channel.send("Our avatar was graciously provided to us, with permission, by @HetreaSky on Twitter.")
|
||||
|
|
Loading…
Reference in New Issue
Block a user