1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

fix stuff

This commit is contained in:
Steffo 2020-08-30 19:00:31 +02:00
parent 2f358b2e70
commit 14f7a0e7f9
5 changed files with 7 additions and 7 deletions

View file

@ -2,7 +2,7 @@
[tool.poetry]
name = "royalpack"
version = "5.14.7"
version = "5.14.8"
description = "A Royalnet command pack for the Royal Games community"
authors = ["Stefano Pigozzi <ste.pigozzi@gmail.com>"]
license = "AGPL-3.0+"

View file

@ -21,6 +21,6 @@ class DiarioquoteCommand(rc.Command):
raise rc.CommandError("L'id che hai specificato non è valido.")
async with data.session_acm() as session:
entry: Diario = await ru.asyncify(session.query(self.alchemy.get(Diario)).get, entry_id)
if entry is None:
raise rc.CommandError("Nessuna riga con quell'id trovata.")
await data.reply(f" {entry}")
if entry is None:
raise rc.CommandError("Nessuna riga con quell'id trovata.")
await data.reply(f" {entry}")

View file

@ -61,7 +61,7 @@ class OsuCommand(LinkerCommand):
async with aiohttp.ClientSession(headers={"Authorization": f"Bearer {obj.access_token}"}) as session:
async with session.get("https://osu.ppy.sh/api/v2/me/osu") as response:
m = await response.json()
obj.avatar_url = m["avatar_url"]
obj.avatar_url = m.get("avatar_url")
obj.username = m["username"]
if "statistics" in m:
await change("standard_pp", m["statistics"].get("pp"))

View file

@ -66,7 +66,7 @@ class Osu(Updatable):
client_secret=client_secret,
refresh_code=self.refresh_token)
self.access_token = j["access_token"]
self.refresh_token = j["refresh_token"]
self.refresh_token = j.get("refresh_token") or self.refresh_token
self.expiration_date = datetime.datetime.now() + datetime.timedelta(seconds=j["expires_in"])
async def refresh_if_expired(self, *, client_id, client_secret):

View file

@ -19,7 +19,7 @@ async def oauth_refresh(*, url, client_id, client_secret, refresh_code):
async with session.post(url, data={
"client_id": client_id,
"client_secret": client_secret,
"code": refresh_code,
"refresh_token": refresh_code,
"grant_type": "refresh_token"
}) as response:
j = await response.json()