diff --git a/pyproject.toml b/pyproject.toml index a08b8dad..c26605dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 "] license = "AGPL-3.0+" diff --git a/royalpack/commands/diarioquote.py b/royalpack/commands/diarioquote.py index e5039e53..0187a2a7 100644 --- a/royalpack/commands/diarioquote.py +++ b/royalpack/commands/diarioquote.py @@ -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}") diff --git a/royalpack/commands/osu.py b/royalpack/commands/osu.py index 6e8b4824..b6767006 100644 --- a/royalpack/commands/osu.py +++ b/royalpack/commands/osu.py @@ -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")) diff --git a/royalpack/tables/osu.py b/royalpack/tables/osu.py index 6ede125f..8faa1f47 100644 --- a/royalpack/tables/osu.py +++ b/royalpack/tables/osu.py @@ -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): diff --git a/royalpack/types/oauth.py b/royalpack/types/oauth.py index 9e271a4d..c3291094 100644 --- a/royalpack/types/oauth.py +++ b/royalpack/types/oauth.py @@ -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()