discord.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:website 作者: DiscordEmotes 项目源码 文件源码
def current(cls):
        """Returns the current User if applicable, None if not authenticated."""
        token = session.get('oauth2_token')
        if token is None:
            return None

        with make_session(token=token) as discord:
            data = cache.get_cached_user_data(token)
            if data is None:
                user = discord.get(DISCORD_API_URL + '/users/@me')
                if user.status_code == 401:
                    # our token is invalidated
                    session.pop('oauth2_token')
                    return None

                data = user.json()
                cache.set_cached_user_data(token, data)

            return cls(data) if data else None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号