nonebot2/archive/2.0.0a16/api/handler.md
2021-10-02 17:35:10 +08:00

1.2 KiB

contentSidebar sidebarDepth
true 0

NoneBot.handler 模块

事件处理函数

该模块实现事件处理函数的封装,以实现动态参数等功能。

class Handler

基类:object

事件处理函数类

__init__(func)

装饰事件处理函数以便根据动态参数运行

func

  • 类型

    T_Handler

  • 说明

    事件处理函数

signature

  • 类型

    inspect.Signature

  • 说明

    事件处理函数签名

property bot_type

  • 类型

    Union[Type["Bot"], inspect.Parameter.empty]

  • 说明

    事件处理函数接受的 Bot 对象类型

property event_type

  • 类型

    Optional[Union[Type[Event], inspect.Parameter.empty]]

  • 说明

    事件处理函数接受的 event 类型 / 不需要 event 参数

property state_type

  • 类型

    Optional[Union[T_State, inspect.Parameter.empty]]

  • 说明

    事件处理函数是否接受 state 参数

property matcher_type

  • 类型

    Optional[Union[Type["Matcher"], inspect.Parameter.empty]]

  • 说明

    事件处理函数是否接受 matcher 参数