Giter Club home page Giter Club logo

onebot-cai's Introduction

from typing import ClassVar

from earth.entity import Human, Lovable
from earth.role import Student
from earth.things.computer import (
    OS,
    Editor,
    Framework,
    Language,
    Linux,
    Windows,
)
from earth.utils.links import GitHub
from earth.world import current_world as world


class MingxuanGame(Human, Lovable):
    age: int = 16
    nickname: ClassVar[set] = {"mx", "mxg", "mg", ...}
    role: Student = Student.SENIOR_HIGH

    tools: "list[OS | Editor]" = [
        Windows._11,
        Linux.WSL.Ubuntu,
        Editor.VSCode,
        Editor.IntellijIdea,
    ]
    skills: list[Language] = [Language.Python]
    learning: "list[Language | Framework]" = [
        Language.C,
        Language.JavaScript,
        Language.CSharp,
        Framework.Vue,
        Language.Go,
    ]

    projects: list[GitHub] = [GitHub("Herta-villa/Herta-villa-SDK")]
    contributed: list[GitHub] = [
        GitHub("KimigaiiWuyi/GenshinUID"),
        GitHub("baiqwerdvd/StarRailUID"),
        GitHub("nonebot/nonebot2"),
    ]


me = MingxuanGame()
world.add_thing(me)
world.execute(me)

onebot-cai's People

Contributors

dependabot[bot] avatar mingxuangame avatar pre-commit-ci[bot] avatar sourcery-ai-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

sourcery-ai-bot

onebot-cai's Issues

关于正向 WebSocket 拒绝响应的返回说明

正如我在下面提到的

def register_exception_handles(app: FastAPI):
"""
注册异常处理函数,仅适用于 HTTP 和正向 WebSocket
FIXME: 在正向 WebSocket,只会返回 403
有关此问题,请参考 [encode/uvicorn#1181](https://github.com/encode/uvicorn/issues/1181)
注:在 ASGI 规范中,对拒绝响应应使用 HTTP 状态码 403 [ASGI WebSocket 规范-close](https://github.com/django/asgiref/blob/main/specs/www.rst#close---send-event)
但是在 [ASGI WebSocket 拒绝响应扩展](https://github.com/django/asgiref/blob/main/docs/extensions.rst#websocket-denial-response),允许 ASGI 框架控制拒绝响应
"""

ASGI 规范中,拒绝响应(即 accept 前)的 close 事件要求返回 403 Forbidden

If this is sent before the socket is accepted, the server must close the connection with a HTTP 403 error code (Forbidden)

这与 OneBot Connect所规定的正向 WebSocket 错误返回 401404 有所区别

但是在 ASGI WebSocket 拒绝响应扩展 中,允许框架自行控制拒绝响应

The core ASGI specification does not allow for any control over the denial response, instead specifying that the HTTP status code 403 should be returned, whereas this extension allows an ASGI framework to control the denial response.

所以有关支持正向 WebSocket 拒绝响应的返回说明,需要等待 uvicornstarlettefastapi 等的更新

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.