Archived
1
0
Fork 0
This repository has been archived on 2024-04-26. You can view files and clone it, but cannot push or open issues or pull requests.
akari-bot/modules/cytoid/utils.py
2023-02-05 22:33:33 +08:00

16 lines
447 B
Python

import ujson as json
from core.utils.http import get_url
async def get_profile_name(userid):
profile_url = 'http://services.cytoid.io/profile/' + userid
profile = json.loads(await get_url(profile_url, 200))
if 'statusCode' in profile:
if profile['statusCode'] == 404:
return False
uid = profile['user']['uid']
nick = profile['user']['name']
if nick is None:
nick = False
return uid, nick