Sarenrae: fix permanent token storage

This commit is contained in:
skins 2021-09-01 21:23:45 +01:00
parent ddbe7a4f46
commit b9929e1c1c

View File

@ -27,7 +27,7 @@ class Sarenrae(commands.Cog):
@commands.command()
async def ancestry(self, ctx, *args):
name = args[0]
headers = {"Authorization": self.conf.token()}
headers = {"Authorization": await self.conf.token()}
req = requests.get(f"https://api.pathfinder2.fr/v1/pf2/ancestry?name={name}", headers=headers).json()
html = req["results"][0]["data"]["description"]["value"]
filename = f"ancestry-{name}"
@ -39,7 +39,5 @@ class Sarenrae(commands.Cog):
@commands.command()
@checks.is_owner()
async def sarenrae_token(self, ctx, *args):
for arg in args:
await ctx.send(arg)
self.conf.token.set(args[0])
return await ctx.send(f"Set token to {self.conf.token()}")
await self.conf.token.set(args[0])
return await ctx.send(f"Set token to {await self.conf.token()}")