mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
fix stuff
This commit is contained in:
parent
2f358b2e70
commit
14f7a0e7f9
5 changed files with 7 additions and 7 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "royalpack"
|
name = "royalpack"
|
||||||
version = "5.14.7"
|
version = "5.14.8"
|
||||||
description = "A Royalnet command pack for the Royal Games community"
|
description = "A Royalnet command pack for the Royal Games community"
|
||||||
authors = ["Stefano Pigozzi <ste.pigozzi@gmail.com>"]
|
authors = ["Stefano Pigozzi <ste.pigozzi@gmail.com>"]
|
||||||
license = "AGPL-3.0+"
|
license = "AGPL-3.0+"
|
||||||
|
|
|
@ -21,6 +21,6 @@ class DiarioquoteCommand(rc.Command):
|
||||||
raise rc.CommandError("L'id che hai specificato non è valido.")
|
raise rc.CommandError("L'id che hai specificato non è valido.")
|
||||||
async with data.session_acm() as session:
|
async with data.session_acm() as session:
|
||||||
entry: Diario = await ru.asyncify(session.query(self.alchemy.get(Diario)).get, entry_id)
|
entry: Diario = await ru.asyncify(session.query(self.alchemy.get(Diario)).get, entry_id)
|
||||||
if entry is None:
|
if entry is None:
|
||||||
raise rc.CommandError("Nessuna riga con quell'id trovata.")
|
raise rc.CommandError("Nessuna riga con quell'id trovata.")
|
||||||
await data.reply(f"ℹ️ {entry}")
|
await data.reply(f"ℹ️ {entry}")
|
||||||
|
|
|
@ -61,7 +61,7 @@ class OsuCommand(LinkerCommand):
|
||||||
async with aiohttp.ClientSession(headers={"Authorization": f"Bearer {obj.access_token}"}) as session:
|
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:
|
async with session.get("https://osu.ppy.sh/api/v2/me/osu") as response:
|
||||||
m = await response.json()
|
m = await response.json()
|
||||||
obj.avatar_url = m["avatar_url"]
|
obj.avatar_url = m.get("avatar_url")
|
||||||
obj.username = m["username"]
|
obj.username = m["username"]
|
||||||
if "statistics" in m:
|
if "statistics" in m:
|
||||||
await change("standard_pp", m["statistics"].get("pp"))
|
await change("standard_pp", m["statistics"].get("pp"))
|
||||||
|
|
|
@ -66,7 +66,7 @@ class Osu(Updatable):
|
||||||
client_secret=client_secret,
|
client_secret=client_secret,
|
||||||
refresh_code=self.refresh_token)
|
refresh_code=self.refresh_token)
|
||||||
self.access_token = j["access_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"])
|
self.expiration_date = datetime.datetime.now() + datetime.timedelta(seconds=j["expires_in"])
|
||||||
|
|
||||||
async def refresh_if_expired(self, *, client_id, client_secret):
|
async def refresh_if_expired(self, *, client_id, client_secret):
|
||||||
|
|
|
@ -19,7 +19,7 @@ async def oauth_refresh(*, url, client_id, client_secret, refresh_code):
|
||||||
async with session.post(url, data={
|
async with session.post(url, data={
|
||||||
"client_id": client_id,
|
"client_id": client_id,
|
||||||
"client_secret": client_secret,
|
"client_secret": client_secret,
|
||||||
"code": refresh_code,
|
"refresh_token": refresh_code,
|
||||||
"grant_type": "refresh_token"
|
"grant_type": "refresh_token"
|
||||||
}) as response:
|
}) as response:
|
||||||
j = await response.json()
|
j = await response.json()
|
||||||
|
|
Loading…
Reference in a new issue