Module mirai.adapters.reverse_websocket

此模块提供反向 WebSocket 适配器,适用于 mirai-api-http 的 reverse websocket adapter。

Expand source code
# -*- coding: utf-8 -*-
"""
此模块提供反向 WebSocket 适配器,适用于 mirai-api-http 的 reverse websocket adapter。
"""
from mirai.adapters.base import Adapter
from mirai.api_provider import Method


class ReverseWebSocketAdapter(Adapter):
    """反向 WebSocket 适配器。作为 WebSocket 服务器与 mirai-api-http 沟通。
    """
    async def login(self, qq: int):
        raise NotImplementedError(
            "由于 mirai-api-http 的反向 WebSocket 尚不完善,该适配器尚未实现。"
        )

    async def logout(self):
        pass

    async def call_api(self, api: str, method: Method = Method.GET, **params):
        pass

    async def _background(self):
        pass

    @property
    def asgi(self):
        pass

Classes

class ReverseWebSocketAdapter (verify_key: Optional[str], single_mode: bool = False)

反向 WebSocket 适配器。作为 WebSocket 服务器与 mirai-api-http 沟通。

Args

verify_key
mirai-api-http 配置的认证 key,关闭认证时为 None。
single_mode
是否开启 single_mode,开启后与 session 将无效。
Expand source code
class ReverseWebSocketAdapter(Adapter):
    """反向 WebSocket 适配器。作为 WebSocket 服务器与 mirai-api-http 沟通。
    """
    async def login(self, qq: int):
        raise NotImplementedError(
            "由于 mirai-api-http 的反向 WebSocket 尚不完善,该适配器尚未实现。"
        )

    async def logout(self):
        pass

    async def call_api(self, api: str, method: Method = Method.GET, **params):
        pass

    async def _background(self):
        pass

    @property
    def asgi(self):
        pass

Ancestors

Instance variables

var asgi
Expand source code
@property
def asgi(self):
    pass

Inherited members