Sarenrae: fix permanent token storage

This commit is contained in:
skins 2021-09-01 21:11:56 +01:00
parent dd769ae19c
commit 2e8a18f36b

View File

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