fix: get steam username
This commit is contained in:
parent
27e197be30
commit
82f5d9ad77
6
app.py
6
app.py
@ -111,9 +111,11 @@ async def update_metadata(response: Response, code: str, steam_id: str = Cookie(
|
||||
else:
|
||||
raise HTTPException(status_code=500, detail=data["error"])
|
||||
|
||||
abc = await session.get(f"http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key={os.getenv('STEAM_API_KEY')}&steamids={steam_id}")
|
||||
abc = await abc.json()
|
||||
role = await user.fetch_role_connection()
|
||||
if role is None:
|
||||
role = RoleConnection(platform_name='Steam - Melatonin', platform_username=str(user))
|
||||
role = RoleConnection(platform_name=f"Steam - {data['gameName']}", platform_username=abc["response"]["players"][0]["personaname"])
|
||||
success = 0
|
||||
total = len(data["achievements"])
|
||||
async for achieve in async_list(data["achievements"]):
|
||||
@ -126,7 +128,7 @@ async def update_metadata(response: Response, code: str, steam_id: str = Cookie(
|
||||
role.add_or_edit_metadata(key="completed", value=True)
|
||||
await user.edit_role_connection(role)
|
||||
response.set_cookie(key="steam_id", value="", max_age=1)
|
||||
return RedirectResponse(url="https://steamcommunity.com/id/{steam_id}")
|
||||
return "연동이 완료되었습니다! Discord로 돌아가세요."
|
||||
|
||||
|
||||
uvicorn.run(app, host="0.0.0.0", port=4278)
|
Reference in New Issue
Block a user