From 9e9c1a27e5b8a39898823a57a0b231660b35f695 Mon Sep 17 00:00:00 2001 From: "noneflow[bot]" <129742071+noneflow[bot]@users.noreply.github.com> Date: Mon, 25 Aug 2025 15:02:13 +0000 Subject: [PATCH] :memo: Update changelog --- website/docs/best-practice/alconna/command.md | 1 - .../docs/best-practice/testing/behavior.mdx | 2 - website/src/changelog/changelog.md | 1 + .../version-2.4.1/api/adapters/index.md | 109 ------------------ .../version-2.4.1/api/compat.md | 20 ---- .../version-2.4.1/api/config.md | 2 - .../version-2.4.1/api/dependencies/index.md | 12 -- .../version-2.4.1/api/dependencies/utils.md | 6 - .../version-2.4.1/api/drivers/aiohttp.md | 23 ---- .../version-2.4.1/api/drivers/fastapi.md | 18 --- .../version-2.4.1/api/drivers/httpx.md | 10 -- .../version-2.4.1/api/drivers/index.md | 60 ---------- .../version-2.4.1/api/drivers/none.md | 5 - .../version-2.4.1/api/drivers/quart.md | 18 --- .../version-2.4.1/api/drivers/websockets.md | 16 --- .../version-2.4.1/api/exception.md | 3 - .../versioned_docs/version-2.4.1/api/index.md | 24 ---- .../versioned_docs/version-2.4.1/api/log.md | 5 - .../version-2.4.1/api/matcher.md | 92 --------------- .../version-2.4.1/api/message.md | 12 -- .../version-2.4.1/api/params.md | 52 --------- .../version-2.4.1/api/permission.md | 10 -- .../version-2.4.1/api/plugin/index.md | 8 -- .../version-2.4.1/api/plugin/load.md | 20 ---- .../version-2.4.1/api/plugin/manager.md | 11 -- .../version-2.4.1/api/plugin/model.md | 1 - .../version-2.4.1/api/plugin/on.md | 66 ----------- .../versioned_docs/version-2.4.1/api/rule.md | 37 ------ .../version-2.4.1/api/typing.md | 26 ----- .../versioned_docs/version-2.4.1/api/utils.md | 44 ------- .../best-practice/alconna/command.md | 1 - .../best-practice/testing/behavior.mdx | 2 - .../version-2.4.2/api/adapters/index.md | 109 ------------------ .../version-2.4.2/api/compat.md | 20 ---- .../version-2.4.2/api/config.md | 2 - .../version-2.4.2/api/dependencies/index.md | 12 -- .../version-2.4.2/api/dependencies/utils.md | 6 - .../version-2.4.2/api/drivers/aiohttp.md | 23 ---- .../version-2.4.2/api/drivers/fastapi.md | 18 --- .../version-2.4.2/api/drivers/httpx.md | 10 -- .../version-2.4.2/api/drivers/index.md | 60 ---------- .../version-2.4.2/api/drivers/none.md | 5 - .../version-2.4.2/api/drivers/quart.md | 18 --- .../version-2.4.2/api/drivers/websockets.md | 16 --- .../version-2.4.2/api/exception.md | 3 - .../versioned_docs/version-2.4.2/api/index.md | 24 ---- .../versioned_docs/version-2.4.2/api/log.md | 5 - .../version-2.4.2/api/matcher.md | 92 --------------- .../version-2.4.2/api/message.md | 12 -- .../version-2.4.2/api/params.md | 52 --------- .../version-2.4.2/api/permission.md | 10 -- .../version-2.4.2/api/plugin/index.md | 8 -- .../version-2.4.2/api/plugin/load.md | 20 ---- .../version-2.4.2/api/plugin/manager.md | 11 -- .../version-2.4.2/api/plugin/model.md | 1 - .../version-2.4.2/api/plugin/on.md | 66 ----------- .../versioned_docs/version-2.4.2/api/rule.md | 37 ------ .../version-2.4.2/api/typing.md | 26 ----- .../versioned_docs/version-2.4.2/api/utils.md | 44 ------- .../best-practice/alconna/command.md | 1 - .../best-practice/testing/behavior.mdx | 2 - .../version-2.4.3/api/adapters/index.md | 109 ------------------ .../version-2.4.3/api/compat.md | 20 ---- .../version-2.4.3/api/config.md | 2 - .../version-2.4.3/api/dependencies/index.md | 12 -- .../version-2.4.3/api/dependencies/utils.md | 6 - .../version-2.4.3/api/drivers/aiohttp.md | 27 ----- .../version-2.4.3/api/drivers/fastapi.md | 18 --- .../version-2.4.3/api/drivers/httpx.md | 14 --- .../version-2.4.3/api/drivers/index.md | 62 ---------- .../version-2.4.3/api/drivers/none.md | 5 - .../version-2.4.3/api/drivers/quart.md | 18 --- .../version-2.4.3/api/drivers/websockets.md | 16 --- .../version-2.4.3/api/exception.md | 3 - .../versioned_docs/version-2.4.3/api/index.md | 24 ---- .../versioned_docs/version-2.4.3/api/log.md | 5 - .../version-2.4.3/api/matcher.md | 95 --------------- .../version-2.4.3/api/message.md | 12 -- .../version-2.4.3/api/params.md | 52 --------- .../version-2.4.3/api/permission.md | 10 -- .../version-2.4.3/api/plugin/index.md | 8 -- .../version-2.4.3/api/plugin/load.md | 20 ---- .../version-2.4.3/api/plugin/manager.md | 11 -- .../version-2.4.3/api/plugin/model.md | 1 - .../version-2.4.3/api/plugin/on.md | 66 ----------- .../versioned_docs/version-2.4.3/api/rule.md | 37 ------ .../version-2.4.3/api/typing.md | 28 ----- .../versioned_docs/version-2.4.3/api/utils.md | 44 ------- .../best-practice/alconna/command.md | 1 - .../best-practice/testing/behavior.mdx | 2 - 90 files changed, 1 insertion(+), 2157 deletions(-) diff --git a/website/docs/best-practice/alconna/command.md b/website/docs/best-practice/alconna/command.md index e80b136d..92e6bca3 100644 --- a/website/docs/best-practice/alconna/command.md +++ b/website/docs/best-practice/alconna/command.md @@ -289,7 +289,6 @@ opt2 = Option("--foo", default=OptionResult(value=False, args={"bar": 1})) `Arparma` 有如下属性: - 调试类 - - matched: 是否匹配成功 - error_data: 解析失败时剩余的数据 - error_info: 解析失败时的异常内容 diff --git a/website/docs/best-practice/testing/behavior.mdx b/website/docs/best-practice/testing/behavior.mdx index 3203d8a8..37d55c13 100644 --- a/website/docs/best-practice/testing/behavior.mdx +++ b/website/docs/best-practice/testing/behavior.mdx @@ -155,7 +155,6 @@ async def test_example(app: App): 1. `should_call_send` 定义事件响应器预期发送的消息,即通过[事件响应器操作 send](../../appendices/session-control.mdx#send)进行的操作。`should_call_send` 有四个参数: - - `event`:回复的目标事件。 - `message`:预期的消息对象,可以是 `str`、`Message` 或 `MessageSegment`。 - `result`:send 的返回值,将会返回给插件。 @@ -164,7 +163,6 @@ async def test_example(app: App): 2. `should_call_api` 定义事件响应器预期调用的平台 API 接口,即通过[调用平台 API](../../appendices/api-calling.mdx#调用平台-api)进行的操作。`should_call_api` 有四个参数: - - `api`:API 名称。 - `data`:预期的请求数据。 - `result`:call_api 的返回值,将会返回给插件。 diff --git a/website/src/changelog/changelog.md b/website/src/changelog/changelog.md index 675af67d..0144e58e 100644 --- a/website/src/changelog/changelog.md +++ b/website/src/changelog/changelog.md @@ -9,6 +9,7 @@ toc_max_heading_level: 2 ### 📝 文档 +- Docs: 升级 docusaurus 3.8.1 [@StarHeartHunt](https://github.com/StarHeartHunt) ([#3649](https://github.com/nonebot/nonebot2/pull/3649)) - Docs: 更新文档《手动创建项目》 [@Chen-Luan](https://github.com/Chen-Luan) ([#3623](https://github.com/nonebot/nonebot2/pull/3623)) - Docs: 增加 B站直播间 适配器说明 [@MingxuanGame](https://github.com/MingxuanGame) ([#3636](https://github.com/nonebot/nonebot2/pull/3636)) - Docs: 增加 VoceChat 适配器说明 [@5656565566](https://github.com/5656565566) ([#3627](https://github.com/nonebot/nonebot2/pull/3627)) diff --git a/website/versioned_docs/version-2.4.1/api/adapters/index.md b/website/versioned_docs/version-2.4.1/api/adapters/index.md index 5352562b..4de79286 100644 --- a/website/versioned_docs/version-2.4.1/api/adapters/index.md +++ b/website/versioned_docs/version-2.4.1/api/adapters/index.md @@ -20,7 +20,6 @@ description: nonebot.adapters 模块 通常,在 Adapter 中编写协议通信相关代码,如: 建立通信连接、处理接收与发送 data 等。 - **参数** - - `driver` ([Driver](../drivers/index.md#Driver)): [Driver](../drivers/index.md#Driver) 实例 - `**kwargs` (Any): 其他由 [Driver.register_adapter](../drivers/index.md#Driver-register-adapter) 传入的额外参数 @@ -46,7 +45,6 @@ description: nonebot.adapters 模块 empty - **返回** - - str ### _property_ `config` {#Adapter-config} @@ -64,11 +62,9 @@ description: nonebot.adapters 模块 当有新的 [Bot](#Bot) 实例连接建立成功时调用。 - **参数** - - `bot` ([Bot](#Bot)): [Bot](#Bot) 实例 - **返回** - - None ### _method_ `bot_disconnect(bot)` {#Adapter-bot-disconnect} @@ -80,11 +76,9 @@ description: nonebot.adapters 模块 当有 [Bot](#Bot) 实例连接断开时调用。 - **参数** - - `bot` ([Bot](#Bot)): [Bot](#Bot) 实例 - **返回** - - None ### _method_ `setup_http_server(setup)` {#Adapter-setup-http-server} @@ -92,11 +86,9 @@ description: nonebot.adapters 模块 - **说明:** 设置一个 HTTP 服务器路由配置 - **参数** - - `setup` ([HTTPServerSetup](../drivers/index.md#HTTPServerSetup)) - **返回** - - untyped ### _method_ `setup_websocket_server(setup)` {#Adapter-setup-websocket-server} @@ -104,11 +96,9 @@ description: nonebot.adapters 模块 - **说明:** 设置一个 WebSocket 服务器路由配置 - **参数** - - `setup` ([WebSocketServerSetup](../drivers/index.md#WebSocketServerSetup)) - **返回** - - untyped ### _async method_ `request(setup)` {#Adapter-request} @@ -116,11 +106,9 @@ description: nonebot.adapters 模块 - **说明:** 进行一个 HTTP 客户端请求 - **参数** - - `setup` ([Request](../drivers/index.md#Request)) - **返回** - - [Response](../drivers/index.md#Response) ### _method_ `websocket(setup)` {#Adapter-websocket} @@ -128,21 +116,17 @@ description: nonebot.adapters 模块 - **说明:** 建立一个 WebSocket 客户端连接请求 - **参数** - - `setup` ([Request](../drivers/index.md#Request)) - **返回** - - AsyncGenerator[[WebSocket](../drivers/index.md#WebSocket), None] ### _method_ `on_ready(func)` {#Adapter-on-ready} - **参数** - - `func` (LIFESPAN_FUNC) - **返回** - - LIFESPAN_FUNC ## _abstract class_ `Bot(adapter, self_id)` {#Bot} @@ -154,7 +138,6 @@ description: nonebot.adapters 模块 用于处理上报消息,并提供 API 调用接口。 - **参数** - - `adapter` ([Adapter](#Adapter)): 协议适配器实例 - `self_id` (str): 机器人 ID @@ -188,13 +171,11 @@ description: nonebot.adapters 模块 - **说明:** 调用机器人 API 接口,可以通过该函数或直接通过 bot 属性进行调用 - **参数** - - `api` (str): API 名称 - `**data` (Any): API 数据 - **返回** - - Any - **用法** @@ -209,7 +190,6 @@ description: nonebot.adapters 模块 - **说明:** 调用机器人基础发送消息接口 - **参数** - - `event` ([Event](#Event)): 上报事件 - `message` (str | [Message](#Message) | [MessageSegment](#MessageSegment)): 要发送的消息 @@ -217,7 +197,6 @@ description: nonebot.adapters 模块 - `**kwargs` (Any): 任意额外参数 - **返回** - - Any ### _classmethod_ `on_calling_api(func)` {#Bot-on-calling-api} @@ -227,17 +206,14 @@ description: nonebot.adapters 模块 调用 api 预处理。 钩子函数参数: - - bot: 当前 bot 对象 - api: 调用的 api 名称 - data: api 调用的参数字典 - **参数** - - `func` ([T_CallingAPIHook](../typing.md#T-CallingAPIHook)) - **返回** - - [T_CallingAPIHook](../typing.md#T-CallingAPIHook) ### _classmethod_ `on_called_api(func)` {#Bot-on-called-api} @@ -247,7 +223,6 @@ description: nonebot.adapters 模块 调用 api 后处理。 钩子函数参数: - - bot: 当前 bot 对象 - exception: 调用 api 时发生的错误 - api: 调用的 api 名称 @@ -255,11 +230,9 @@ description: nonebot.adapters 模块 - result: api 调用的返回 - **参数** - - `func` ([T_CalledAPIHook](../typing.md#T-CalledAPIHook)) - **返回** - - [T_CalledAPIHook](../typing.md#T-CalledAPIHook) ## _abstract class_ `Event()` {#Event} @@ -279,7 +252,6 @@ description: nonebot.adapters 模块 empty - **返回** - - str ### _abstract method_ `get_event_name()` {#Event-get-event-name} @@ -291,7 +263,6 @@ description: nonebot.adapters 模块 empty - **返回** - - str ### _abstract method_ `get_event_description()` {#Event-get-event-description} @@ -303,7 +274,6 @@ description: nonebot.adapters 模块 empty - **返回** - - str ### _method_ `get_log_string()` {#Event-get-log-string} @@ -320,11 +290,9 @@ description: nonebot.adapters 模块 empty - **返回** - - str - **异常** - - NoLogException: 希望 NoneBot 隐藏该事件日志 ### _abstract method_ `get_user_id()` {#Event-get-user-id} @@ -336,7 +304,6 @@ description: nonebot.adapters 模块 empty - **返回** - - str ### _abstract method_ `get_session_id()` {#Event-get-session-id} @@ -348,7 +315,6 @@ description: nonebot.adapters 模块 empty - **返回** - - str ### _abstract method_ `get_message()` {#Event-get-message} @@ -360,7 +326,6 @@ description: nonebot.adapters 模块 empty - **返回** - - [Message](#Message) ### _method_ `get_plaintext()` {#Event-get-plaintext} @@ -376,7 +341,6 @@ description: nonebot.adapters 模块 empty - **返回** - - str ### _abstract method_ `is_tome()` {#Event-is-tome} @@ -388,7 +352,6 @@ description: nonebot.adapters 模块 empty - **返回** - - bool ## _abstract class_ `Message()` {#Message} @@ -396,7 +359,6 @@ description: nonebot.adapters 模块 - **说明:** 消息序列 - **参数** - - `message`: 消息内容 ### _classmethod_ `template(format_string)` {#Message-template} @@ -410,11 +372,9 @@ description: nonebot.adapters 模块 可以通过该消息类型的 `MessageSegment` 工厂方法创建消息。 - **参数** - - `format_string` (str | TM): 格式化模板 - **返回** - - [MessageTemplate](#MessageTemplate)[Self]: 消息格式化器 ### _abstract classmethod_ `get_segment_class()` {#Message-get-segment-class} @@ -426,7 +386,6 @@ description: nonebot.adapters 模块 empty - **返回** - - type[TMS] ### _abstract staticmethod_ `_construct(msg)` {#Message--construct} @@ -434,11 +393,9 @@ description: nonebot.adapters 模块 - **说明:** 构造消息数组 - **参数** - - `msg` (str) - **返回** - - Iterable[TMS] ### _method_ `__getitem__(args)` {#Message---getitem--} @@ -446,53 +403,38 @@ description: nonebot.adapters 模块 - **重载** **1.** `(args) -> Self` - - **参数** - - `args` (str): 消息段类型 - **返回** - - Self: 所有类型为 `args` 的消息段 **2.** `(args) -> TMS` - - **参数** - - `args` (tuple[str, int]): 消息段类型和索引 - **返回** - - TMS: 类型为 `args[0]` 的消息段第 `args[1]` 个 **3.** `(args) -> Self` - - **参数** - - `args` (tuple[str, slice]): 消息段类型和切片 - **返回** - - Self: 类型为 `args[0]` 的消息段切片 `args[1]` **4.** `(args) -> TMS` - - **参数** - - `args` (int): 索引 - **返回** - - TMS: 第 `args` 个消息段 **5.** `(args) -> Self` - - **参数** - - `args` (slice): 切片 - **返回** - - Self: 消息切片 `args` ### _method_ `__contains__(value)` {#Message---contains--} @@ -500,11 +442,9 @@ description: nonebot.adapters 模块 - **说明:** 检查消息段是否存在 - **参数** - - `value` (TMS | str): 消息段或消息段类型 - **返回** - - bool: 消息内是否存在给定消息段或给定类型的消息段 ### _method_ `has(value)` {#Message-has} @@ -512,11 +452,9 @@ description: nonebot.adapters 模块 - **说明:** 与 [`__contains__`](#Message---contains--) 相同 - **参数** - - `value` (TMS | str) - **返回** - - bool ### _method_ `index(value, *args)` {#Message-index} @@ -524,7 +462,6 @@ description: nonebot.adapters 模块 - **说明:** 索引消息段 - **参数** - - `value` (TMS | str): 消息段或者消息段类型 - `*args` (SupportsIndex) @@ -532,11 +469,9 @@ description: nonebot.adapters 模块 - `arg`: start 与 end - **返回** - - int: 索引 index - **异常** - - ValueError: 消息段不存在 ### _method_ `get(type_, count=None)` {#Message-get} @@ -544,13 +479,11 @@ description: nonebot.adapters 模块 - **说明:** 获取指定类型的消息段 - **参数** - - `type_` (str): 消息段类型 - `count` (int | None): 获取个数 - **返回** - - Self: 构建的新消息 ### _method_ `count(value)` {#Message-count} @@ -558,11 +491,9 @@ description: nonebot.adapters 模块 - **说明:** 计算指定消息段的个数 - **参数** - - `value` (TMS | str): 消息段或消息段类型 - **返回** - - int: 个数 ### _method_ `only(value)` {#Message-only} @@ -570,11 +501,9 @@ description: nonebot.adapters 模块 - **说明:** 检查消息中是否仅包含指定消息段 - **参数** - - `value` (TMS | str): 指定消息段或消息段类型 - **返回** - - bool: 是否仅包含指定消息段 ### _method_ `append(obj)` {#Message-append} @@ -582,11 +511,9 @@ description: nonebot.adapters 模块 - **说明:** 添加一个消息段到消息数组末尾。 - **参数** - - `obj` (str | TMS): 要添加的消息段 - **返回** - - Self ### _method_ `extend(obj)` {#Message-extend} @@ -594,11 +521,9 @@ description: nonebot.adapters 模块 - **说明:** 拼接一个消息数组或多个消息段到消息数组末尾。 - **参数** - - `obj` (Self | Iterable[TMS]): 要添加的消息数组 - **返回** - - Self ### _method_ `join(iterable)` {#Message-join} @@ -606,11 +531,9 @@ description: nonebot.adapters 模块 - **说明:** 将多个消息连接并将自身作为分割 - **参数** - - `iterable` (Iterable[TMS | Self]): 要连接的消息 - **返回** - - Self: 连接后的消息 ### _method_ `copy()` {#Message-copy} @@ -622,7 +545,6 @@ description: nonebot.adapters 模块 empty - **返回** - - Self ### _method_ `include(*types)` {#Message-include} @@ -630,11 +552,9 @@ description: nonebot.adapters 模块 - **说明:** 过滤消息 - **参数** - - `*types` (str): 包含的消息段类型 - **返回** - - Self: 新构造的消息 ### _method_ `exclude(*types)` {#Message-exclude} @@ -642,11 +562,9 @@ description: nonebot.adapters 模块 - **说明:** 过滤消息 - **参数** - - `*types` (str): 不包含的消息段类型 - **返回** - - Self: 新构造的消息 ### _method_ `extract_plain_text()` {#Message-extract-plain-text} @@ -658,7 +576,6 @@ description: nonebot.adapters 模块 empty - **返回** - - str ## _abstract class_ `MessageSegment()` {#MessageSegment} @@ -690,7 +607,6 @@ description: nonebot.adapters 模块 empty - **返回** - - type[TM] ### _abstract method_ `__str__()` {#MessageSegment---str--} @@ -702,29 +618,24 @@ description: nonebot.adapters 模块 empty - **返回** - - str ### _method_ `__add__(other)` {#MessageSegment---add--} - **参数** - - `other` (str | TMS | Iterable[TMS]) - **返回** - - TM ### _method_ `get(key, default=None)` {#MessageSegment-get} - **参数** - - `key` (str) - `default` (Any) - **返回** - - untyped ### _method_ `keys()` {#MessageSegment-keys} @@ -734,7 +645,6 @@ description: nonebot.adapters 模块 empty - **返回** - - untyped ### _method_ `values()` {#MessageSegment-values} @@ -744,7 +654,6 @@ description: nonebot.adapters 模块 empty - **返回** - - untyped ### _method_ `items()` {#MessageSegment-items} @@ -754,17 +663,14 @@ description: nonebot.adapters 模块 empty - **返回** - - untyped ### _method_ `join(iterable)` {#MessageSegment-join} - **参数** - - `iterable` (Iterable[TMS | TM]) - **返回** - - TM ### _method_ `copy()` {#MessageSegment-copy} @@ -774,7 +680,6 @@ description: nonebot.adapters 模块 empty - **返回** - - Self ### _abstract method_ `is_text()` {#MessageSegment-is-text} @@ -786,7 +691,6 @@ description: nonebot.adapters 模块 empty - **返回** - - bool ## _class_ `MessageTemplate(template, factory=str, private_getattr=False)` {#MessageTemplate} @@ -794,7 +698,6 @@ description: nonebot.adapters 模块 - **说明:** 消息模板格式化实现类。 - **参数** - - `template` (str | TM): 模板 - `factory` (type[str] | type[TM]): 消息类型工厂,默认为 `str` @@ -804,13 +707,11 @@ description: nonebot.adapters 模块 ### _method_ `add_format_spec(spec, name=None)` {#MessageTemplate-add-format-spec} - **参数** - - `spec` (FormatSpecFunc_T) - `name` (str | None) - **返回** - - FormatSpecFunc_T ### _method_ `format(*args, **kwargs)` {#MessageTemplate-format} @@ -818,13 +719,11 @@ description: nonebot.adapters 模块 - **说明:** 根据传入参数和模板生成消息对象 - **参数** - - `*args` - `**kwargs` - **返回** - - TF ### _method_ `format_map(mapping)` {#MessageTemplate-format-map} @@ -832,17 +731,14 @@ description: nonebot.adapters 模块 - **说明:** 根据传入字典和模板生成消息对象, 在传入字段名不是有效标识符时有用 - **参数** - - `mapping` (Mapping[str, Any]) - **返回** - - TF ### _method_ `vformat(format_string, args, kwargs)` {#MessageTemplate-vformat} - **参数** - - `format_string` (str) - `args` (Sequence[Any]) @@ -850,13 +746,11 @@ description: nonebot.adapters 模块 - `kwargs` (Mapping[str, Any]) - **返回** - - TF ### _method_ `get_field(field_name, args, kwargs)` {#MessageTemplate-get-field} - **参数** - - `field_name` (str) - `args` (Sequence[Any]) @@ -864,17 +758,14 @@ description: nonebot.adapters 模块 - `kwargs` (Mapping[str, Any]) - **返回** - - tuple[Any, int | str] ### _method_ `format_field(value, format_spec)` {#MessageTemplate-format-field} - **参数** - - `value` (Any) - `format_spec` (str) - **返回** - - Any diff --git a/website/versioned_docs/version-2.4.1/api/compat.md b/website/versioned_docs/version-2.4.1/api/compat.md index e4f9da20..b497b6f4 100644 --- a/website/versioned_docs/version-2.4.1/api/compat.md +++ b/website/versioned_docs/version-2.4.1/api/compat.md @@ -36,7 +36,6 @@ description: nonebot.compat 模块 - **说明:** FieldInfo class with extra property for compatibility with pydantic v1 - **参数** - - `default` (Any) - `**kwargs` (Any) @@ -82,7 +81,6 @@ description: nonebot.compat 模块 - **说明:** Construct a ModelField from given infos. - **参数** - - `name` (str) - `annotation` (Any) @@ -90,7 +88,6 @@ description: nonebot.compat 模块 - `field_info` (FieldInfo | None) - **返回** - - Self ### _method_ `get_default()` {#ModelField-get-default} @@ -102,7 +99,6 @@ description: nonebot.compat 模块 empty - **返回** - - Any ### _method_ `validate_value(value)` {#ModelField-validate-value} @@ -110,11 +106,9 @@ description: nonebot.compat 模块 - **说明:** Validate the value pass to the field. - **参数** - - `value` (Any) - **返回** - - Any ## _def_ `extract_field_info(field_info)` {#extract-field-info} @@ -122,11 +116,9 @@ description: nonebot.compat 模块 - **说明:** Get FieldInfo init kwargs from a FieldInfo instance. - **参数** - - `field_info` (BaseFieldInfo) - **返回** - - dict[str, Any] ## _def_ `model_fields(model)` {#model-fields} @@ -134,11 +126,9 @@ description: nonebot.compat 模块 - **说明:** Get field list of a model. - **参数** - - `model` (type[BaseModel]) - **返回** - - list[ModelField] ## _def_ `model_config(model)` {#model-config} @@ -146,17 +136,14 @@ description: nonebot.compat 模块 - **说明:** Get config of a model. - **参数** - - `model` (type[BaseModel]) - **返回** - - Any ## _def_ `model_dump(model, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False)` {#model-dump} - **参数** - - `model` (BaseModel) - `include` (set[str] | None) @@ -172,7 +159,6 @@ description: nonebot.compat 模块 - `exclude_none` (bool) - **返回** - - dict[str, Any] ## _def_ `type_validate_python(type_, data)` {#type-validate-python} @@ -180,13 +166,11 @@ description: nonebot.compat 模块 - **说明:** Validate data with given type. - **参数** - - `type_` (type[T]) - `data` (Any) - **返回** - - T ## _def_ `type_validate_json(type_, data)` {#type-validate-json} @@ -194,13 +178,11 @@ description: nonebot.compat 模块 - **说明:** Validate JSON with given type. - **参数** - - `type_` (type[T]) - `data` (str | bytes) - **返回** - - T ## _def_ `custom_validation(class_)` {#custom-validation} @@ -208,9 +190,7 @@ description: nonebot.compat 模块 - **说明:** Use pydantic v1 like validator generator in pydantic v2 - **参数** - - `class_` (type[CVC]) - **返回** - - type[CVC] diff --git a/website/versioned_docs/version-2.4.1/api/config.md b/website/versioned_docs/version-2.4.1/api/config.md index 847404fd..6bf23ee8 100644 --- a/website/versioned_docs/version-2.4.1/api/config.md +++ b/website/versioned_docs/version-2.4.1/api/config.md @@ -24,7 +24,6 @@ NoneBot 使用 [`pydantic`](https://pydantic-docs.helpmanual.io/) 以及 将会从 **环境变量** > **dotenv 配置文件** 的优先级读取环境信息。 - **参数** - - `_env_file` (DOTENV_TYPE | None) - `_env_file_encoding` (str | None) @@ -55,7 +54,6 @@ NoneBot 使用 [`pydantic`](https://pydantic-docs.helpmanual.io/) 以及 配置方法参考: [配置](https://nonebot.dev/docs/appendices/config) - **参数** - - `_env_file` (DOTENV_TYPE | None) - `_env_file_encoding` (str | None) diff --git a/website/versioned_docs/version-2.4.1/api/dependencies/index.md b/website/versioned_docs/version-2.4.1/api/dependencies/index.md index c11b6e8c..74732936 100644 --- a/website/versioned_docs/version-2.4.1/api/dependencies/index.md +++ b/website/versioned_docs/version-2.4.1/api/dependencies/index.md @@ -18,7 +18,6 @@ description: nonebot.dependencies 模块 继承自 `pydantic.fields.FieldInfo`,用于描述参数信息(不包括参数名)。 - **参数** - - `*args` - `validate` (bool) @@ -30,7 +29,6 @@ description: nonebot.dependencies 模块 - **说明:** 依赖注入容器 - **参数** - - `call`: 依赖注入的可调用对象,可以是任何 Callable 对象 - `pre_checkers`: 依赖注入解析前的参数检查 @@ -44,31 +42,26 @@ description: nonebot.dependencies 模块 ### _staticmethod_ `parse_params(call, allow_types)` {#Dependent-parse-params} - **参数** - - `call` (\_DependentCallable[R]) - `allow_types` (tuple[type[Param], ...]) - **返回** - - tuple[[ModelField](../compat.md#ModelField), ...] ### _staticmethod_ `parse_parameterless(parameterless, allow_types)` {#Dependent-parse-parameterless} - **参数** - - `parameterless` (tuple[Any, ...]) - `allow_types` (tuple[type[Param], ...]) - **返回** - - tuple[Param, ...] ### _classmethod_ `parse(*, call, parameterless=None, allow_types)` {#Dependent-parse} - **参数** - - `call` (\_DependentCallable[R]) - `parameterless` (Iterable[Any] | None) @@ -76,25 +69,20 @@ description: nonebot.dependencies 模块 - `allow_types` (Iterable[type[Param]]) - **返回** - - Dependent[R] ### _async method_ `check(**params)` {#Dependent-check} - **参数** - - `**params` (Any) - **返回** - - None ### _async method_ `solve(**params)` {#Dependent-solve} - **参数** - - `**params` (Any) - **返回** - - dict[str, Any] diff --git a/website/versioned_docs/version-2.4.1/api/dependencies/utils.md b/website/versioned_docs/version-2.4.1/api/dependencies/utils.md index 10c4fd74..2b19f9c5 100644 --- a/website/versioned_docs/version-2.4.1/api/dependencies/utils.md +++ b/website/versioned_docs/version-2.4.1/api/dependencies/utils.md @@ -12,11 +12,9 @@ description: nonebot.dependencies.utils 模块 - **说明:** 获取可调用对象签名 - **参数** - - `call` ((...) -> Any) - **返回** - - inspect.Signature ## _def_ `get_typed_annotation(param, globalns)` {#get-typed-annotation} @@ -24,13 +22,11 @@ description: nonebot.dependencies.utils 模块 - **说明:** 获取参数的类型注解 - **参数** - - `param` (inspect.Parameter) - `globalns` (dict[str, Any]) - **返回** - - Any ## _def_ `check_field_type(field, value)` {#check-field-type} @@ -38,11 +34,9 @@ description: nonebot.dependencies.utils 模块 - **说明:** 检查字段类型是否匹配 - **参数** - - `field` ([ModelField](../compat.md#ModelField)) - `value` (Any) - **返回** - - Any diff --git a/website/versioned_docs/version-2.4.1/api/drivers/aiohttp.md b/website/versioned_docs/version-2.4.1/api/drivers/aiohttp.md index 57147258..a45a245c 100644 --- a/website/versioned_docs/version-2.4.1/api/drivers/aiohttp.md +++ b/website/versioned_docs/version-2.4.1/api/drivers/aiohttp.md @@ -22,7 +22,6 @@ pip install nonebot2[aiohttp] ## _class_ `Session(params=None, headers=None, cookies=None, version=HTTPVersion.H11, timeout=None, proxy=None)` {#Session} - **参数** - - `params` (QueryTypes) - `headers` (HeaderTypes) @@ -38,11 +37,9 @@ pip install nonebot2[aiohttp] ### _async method_ `request(setup)` {#Session-request} - **参数** - - `setup` ([Request](index.md#Request)) - **返回** - - [Response](index.md#Response) ### _async method_ `setup()` {#Session-setup} @@ -52,7 +49,6 @@ pip install nonebot2[aiohttp] empty - **返回** - - None ### _async method_ `close()` {#Session-close} @@ -62,7 +58,6 @@ pip install nonebot2[aiohttp] empty - **返回** - - None ## _class_ `Mixin()` {#Mixin} @@ -76,27 +71,22 @@ pip install nonebot2[aiohttp] ### _async method_ `request(setup)` {#Mixin-request} - **参数** - - `setup` ([Request](index.md#Request)) - **返回** - - [Response](index.md#Response) ### _method_ `websocket(setup)` {#Mixin-websocket} - **参数** - - `setup` ([Request](index.md#Request)) - **返回** - - AsyncGenerator[[WebSocket](index.md#WebSocket), None] ### _method_ `get_session(params=None, headers=None, cookies=None, version=HTTPVersion.H11, timeout=None, proxy=None)` {#Mixin-get-session} - **参数** - - `params` (QueryTypes) - `headers` (HeaderTypes) @@ -110,7 +100,6 @@ pip install nonebot2[aiohttp] - `proxy` (str | None) - **返回** - - Session ## _class_ `WebSocket(*, request, session, websocket)` {#WebSocket} @@ -118,7 +107,6 @@ pip install nonebot2[aiohttp] - **说明:** AIOHTTP Websocket Wrapper - **参数** - - `request` ([Request](index.md#Request)) - `session` (aiohttp.ClientSession) @@ -132,19 +120,16 @@ pip install nonebot2[aiohttp] empty - **返回** - - untyped ### _async method_ `close(code=1000, reason="")` {#WebSocket-close} - **参数** - - `code` (int) - `reason` (str) - **返回** - - untyped ### _async method_ `receive()` {#WebSocket-receive} @@ -154,7 +139,6 @@ pip install nonebot2[aiohttp] empty - **返回** - - str ### _async method_ `receive_text()` {#WebSocket-receive-text} @@ -164,7 +148,6 @@ pip install nonebot2[aiohttp] empty - **返回** - - str ### _async method_ `receive_bytes()` {#WebSocket-receive-bytes} @@ -174,33 +157,27 @@ pip install nonebot2[aiohttp] empty - **返回** - - bytes ### _async method_ `send_text(data)` {#WebSocket-send-text} - **参数** - - `data` (str) - **返回** - - None ### _async method_ `send_bytes(data)` {#WebSocket-send-bytes} - **参数** - - `data` (bytes) - **返回** - - None ## _class_ `Driver(env, config)` {#Driver} - **参数** - - `env` ([Env](../config.md#Env)) - `config` ([Config](../config.md#Config)) diff --git a/website/versioned_docs/version-2.4.1/api/drivers/fastapi.md b/website/versioned_docs/version-2.4.1/api/drivers/fastapi.md index bc7da389..0e80894e 100644 --- a/website/versioned_docs/version-2.4.1/api/drivers/fastapi.md +++ b/website/versioned_docs/version-2.4.1/api/drivers/fastapi.md @@ -92,7 +92,6 @@ pip install nonebot2[fastapi] - **说明:** FastAPI 驱动框架。 - **参数** - - `env` ([Env](../config.md#Env)) - `config` (NoneBotConfig) @@ -124,21 +123,17 @@ pip install nonebot2[fastapi] ### _method_ `setup_http_server(setup)` {#Driver-setup-http-server} - **参数** - - `setup` ([HTTPServerSetup](index.md#HTTPServerSetup)) - **返回** - - untyped ### _method_ `setup_websocket_server(setup)` {#Driver-setup-websocket-server} - **参数** - - `setup` ([WebSocketServerSetup](index.md#WebSocketServerSetup)) - **返回** - - None ### _method_ `run(host=None, port=None, *args, app=None, **kwargs)` {#Driver-run} @@ -146,7 +141,6 @@ pip install nonebot2[fastapi] - **说明:** 使用 `uvicorn` 启动 FastAPI - **参数** - - `host` (str | None) - `port` (int | None) @@ -158,7 +152,6 @@ pip install nonebot2[fastapi] - `**kwargs` - **返回** - - untyped ## _class_ `FastAPIWebSocket(*, request, websocket)` {#FastAPIWebSocket} @@ -166,7 +159,6 @@ pip install nonebot2[fastapi] - **说明:** FastAPI WebSocket Wrapper - **参数** - - `request` (BaseRequest) - `websocket` ([WebSocket](index.md#WebSocket)) @@ -178,19 +170,16 @@ pip install nonebot2[fastapi] empty - **返回** - - None ### _async method_ `close(code=status.WS_1000_NORMAL_CLOSURE, reason="")` {#FastAPIWebSocket-close} - **参数** - - `code` (int) - `reason` (str) - **返回** - - None ### _async method_ `receive()` {#FastAPIWebSocket-receive} @@ -200,7 +189,6 @@ pip install nonebot2[fastapi] empty - **返回** - - str | bytes ### _async method_ `receive_text()` {#FastAPIWebSocket-receive-text} @@ -210,7 +198,6 @@ pip install nonebot2[fastapi] empty - **返回** - - str ### _async method_ `receive_bytes()` {#FastAPIWebSocket-receive-bytes} @@ -220,25 +207,20 @@ pip install nonebot2[fastapi] empty - **返回** - - bytes ### _async method_ `send_text(data)` {#FastAPIWebSocket-send-text} - **参数** - - `data` (str) - **返回** - - None ### _async method_ `send_bytes(data)` {#FastAPIWebSocket-send-bytes} - **参数** - - `data` (bytes) - **返回** - - None diff --git a/website/versioned_docs/version-2.4.1/api/drivers/httpx.md b/website/versioned_docs/version-2.4.1/api/drivers/httpx.md index e40efc39..8b5a6b53 100644 --- a/website/versioned_docs/version-2.4.1/api/drivers/httpx.md +++ b/website/versioned_docs/version-2.4.1/api/drivers/httpx.md @@ -22,7 +22,6 @@ pip install nonebot2[httpx] ## _class_ `Session(params=None, headers=None, cookies=None, version=HTTPVersion.H11, timeout=None, proxy=None)` {#Session} - **参数** - - `params` (QueryTypes) - `headers` (HeaderTypes) @@ -38,11 +37,9 @@ pip install nonebot2[httpx] ### _async method_ `request(setup)` {#Session-request} - **参数** - - `setup` ([Request](index.md#Request)) - **返回** - - [Response](index.md#Response) ### _async method_ `setup()` {#Session-setup} @@ -52,7 +49,6 @@ pip install nonebot2[httpx] empty - **返回** - - None ### _async method_ `close()` {#Session-close} @@ -62,7 +58,6 @@ pip install nonebot2[httpx] empty - **返回** - - None ## _class_ `Mixin()` {#Mixin} @@ -76,17 +71,14 @@ pip install nonebot2[httpx] ### _async method_ `request(setup)` {#Mixin-request} - **参数** - - `setup` ([Request](index.md#Request)) - **返回** - - [Response](index.md#Response) ### _method_ `get_session(params=None, headers=None, cookies=None, version=HTTPVersion.H11, timeout=None, proxy=None)` {#Mixin-get-session} - **参数** - - `params` (QueryTypes) - `headers` (HeaderTypes) @@ -100,13 +92,11 @@ pip install nonebot2[httpx] - `proxy` (str | None) - **返回** - - Session ## _class_ `Driver(env, config)` {#Driver} - **参数** - - `env` ([Env](../config.md#Env)) - `config` ([Config](../config.md#Config)) diff --git a/website/versioned_docs/version-2.4.1/api/drivers/index.md b/website/versioned_docs/version-2.4.1/api/drivers/index.md index 50aff1fe..b44384e1 100644 --- a/website/versioned_docs/version-2.4.1/api/drivers/index.md +++ b/website/versioned_docs/version-2.4.1/api/drivers/index.md @@ -40,11 +40,9 @@ description: nonebot.drivers 模块 - **说明:** 设置一个 HTTP 服务器路由配置 - **参数** - - `setup` ([HTTPServerSetup](#HTTPServerSetup)) - **返回** - - None ### _abstract method_ `setup_websocket_server(setup)` {#ASGIMixin-setup-websocket-server} @@ -52,23 +50,19 @@ description: nonebot.drivers 模块 - **说明:** 设置一个 WebSocket 服务器路由配置 - **参数** - - `setup` ([WebSocketServerSetup](#WebSocketServerSetup)) - **返回** - - None ## _class_ `Cookies(cookies=None)` {#Cookies} - **参数** - - `cookies` (CookieTypes) ### _method_ `set(name, value, domain="", path="/")` {#Cookies-set} - **参数** - - `name` (str) - `value` (str) @@ -78,13 +72,11 @@ description: nonebot.drivers 模块 - `path` (str) - **返回** - - None ### _method_ `get(name, default=None, domain=None, path=None)` {#Cookies-get} - **参数** - - `name` (str) - `default` (str | None) @@ -94,13 +86,11 @@ description: nonebot.drivers 模块 - `path` (str | None) - **返回** - - str | None ### _method_ `delete(name, domain=None, path=None)` {#Cookies-delete} - **参数** - - `name` (str) - `domain` (str | None) @@ -108,39 +98,32 @@ description: nonebot.drivers 模块 - `path` (str | None) - **返回** - - None ### _method_ `clear(domain=None, path=None)` {#Cookies-clear} - **参数** - - `domain` (str | None) - `path` (str | None) - **返回** - - None ### _method_ `update(cookies=None)` {#Cookies-update} - **参数** - - `cookies` (CookieTypes) - **返回** - - None ### _method_ `as_header(request)` {#Cookies-as-header} - **参数** - - `request` (Request) - **返回** - - dict[str, str] ## _abstract class_ `Driver(env, config)` {#Driver} @@ -152,7 +135,6 @@ description: nonebot.drivers 模块 驱动器控制框架的启动和停止,适配器的注册,以及机器人生命周期管理。 - **参数** - - `env` ([Env](../config.md#Env)): 包含环境信息的 Env 对象 - `config` ([Config](../config.md#Config)): 包含配置信息的 Config 对象 @@ -180,13 +162,11 @@ description: nonebot.drivers 模块 - **说明:** 注册一个协议适配器 - **参数** - - `adapter` (type[[Adapter](../adapters/index.md#Adapter)]): 适配器类 - `**kwargs`: 其他传递给适配器的参数 - **返回** - - None ### _abstract property_ `type` {#Driver-type} @@ -206,13 +186,11 @@ description: nonebot.drivers 模块 - **说明:** 启动驱动框架 - **参数** - - `*args` - `**kwargs` - **返回** - - untyped ### _method_ `on_startup(func)` {#Driver-on-startup} @@ -220,11 +198,9 @@ description: nonebot.drivers 模块 - **说明:** 注册一个启动时执行的函数 - **参数** - - `func` (LIFESPAN_FUNC) - **返回** - - LIFESPAN_FUNC ### _method_ `on_shutdown(func)` {#Driver-on-shutdown} @@ -232,11 +208,9 @@ description: nonebot.drivers 模块 - **说明:** 注册一个停止时执行的函数 - **参数** - - `func` (LIFESPAN_FUNC) - **返回** - - LIFESPAN_FUNC ### _classmethod_ `on_bot_connect(func)` {#Driver-on-bot-connect} @@ -246,15 +220,12 @@ description: nonebot.drivers 模块 装饰一个函数使他在 bot 连接成功时执行。 钩子函数参数: - - bot: 当前连接上的 Bot 对象 - **参数** - - `func` ([T_BotConnectionHook](../typing.md#T-BotConnectionHook)) - **返回** - - [T_BotConnectionHook](../typing.md#T-BotConnectionHook) ### _classmethod_ `on_bot_disconnect(func)` {#Driver-on-bot-disconnect} @@ -264,15 +235,12 @@ description: nonebot.drivers 模块 装饰一个函数使他在 bot 连接断开时执行。 钩子函数参数: - - bot: 当前连接上的 Bot 对象 - **参数** - - `func` ([T_BotDisconnectionHook](../typing.md#T-BotDisconnectionHook)) - **返回** - - [T_BotDisconnectionHook](../typing.md#T-BotDisconnectionHook) ## _var_ `ForwardDriver` {#ForwardDriver} @@ -306,11 +274,9 @@ description: nonebot.drivers 模块 - **说明:** 发送一个 HTTP 请求 - **参数** - - `setup` ([Request](#Request)) - **返回** - - [Response](#Response) ### _abstract method_ `get_session(params=None, headers=None, cookies=None, version=HTTPVersion.H11, timeout=None, proxy=None)` {#HTTPClientMixin-get-session} @@ -318,7 +284,6 @@ description: nonebot.drivers 模块 - **说明:** 获取一个 HTTP 会话 - **参数** - - `params` (QueryTypes) - `headers` (HeaderTypes) @@ -332,7 +297,6 @@ description: nonebot.drivers 模块 - `proxy` (str | None) - **返回** - - HTTPClientSession ## _class_ `HTTPServerSetup()` {#HTTPServerSetup} @@ -350,7 +314,6 @@ description: nonebot.drivers 模块 - **参数** auto - - `H10: '1.0'` - `H11: '1.1'` @@ -374,7 +337,6 @@ description: nonebot.drivers 模块 ## _class_ `Request(method, url, *, params=None, headers=None, cookies=None, content=None, data=None, json=None, files=None, version=HTTPVersion.H11, timeout=None, proxy=None)` {#Request} - **参数** - - `method` (str | bytes) - `url` (URL | str | RawURL) @@ -402,7 +364,6 @@ description: nonebot.drivers 模块 ## _class_ `Response(status_code, *, headers=None, content=None, request=None)` {#Response} - **参数** - - `status_code` (int) - `headers` (HeaderTypes) @@ -432,7 +393,6 @@ description: nonebot.drivers 模块 ## _abstract class_ `WebSocket(*, request)` {#WebSocket} - **参数** - - `request` (Request) ### _abstract property_ `closed` {#WebSocket-closed} @@ -450,7 +410,6 @@ description: nonebot.drivers 模块 empty - **返回** - - None ### _abstract async method_ `close(code=1000, reason="")` {#WebSocket-close} @@ -458,13 +417,11 @@ description: nonebot.drivers 模块 - **说明:** 关闭 WebSocket 连接请求 - **参数** - - `code` (int) - `reason` (str) - **返回** - - None ### _abstract async method_ `receive()` {#WebSocket-receive} @@ -476,7 +433,6 @@ description: nonebot.drivers 模块 empty - **返回** - - str | bytes ### _abstract async method_ `receive_text()` {#WebSocket-receive-text} @@ -488,7 +444,6 @@ description: nonebot.drivers 模块 empty - **返回** - - str ### _abstract async method_ `receive_bytes()` {#WebSocket-receive-bytes} @@ -500,7 +455,6 @@ description: nonebot.drivers 模块 empty - **返回** - - bytes ### _async method_ `send(data)` {#WebSocket-send} @@ -508,11 +462,9 @@ description: nonebot.drivers 模块 - **说明:** 发送一条 WebSocket text/bytes 信息 - **参数** - - `data` (str | bytes) - **返回** - - None ### _abstract async method_ `send_text(data)` {#WebSocket-send-text} @@ -520,11 +472,9 @@ description: nonebot.drivers 模块 - **说明:** 发送一条 WebSocket text 信息 - **参数** - - `data` (str) - **返回** - - None ### _abstract async method_ `send_bytes(data)` {#WebSocket-send-bytes} @@ -532,11 +482,9 @@ description: nonebot.drivers 模块 - **说明:** 发送一条 WebSocket binary 信息 - **参数** - - `data` (bytes) - **返回** - - None ## _abstract class_ `WebSocketClientMixin()` {#WebSocketClientMixin} @@ -552,11 +500,9 @@ description: nonebot.drivers 模块 - **说明:** 发起一个 WebSocket 连接 - **参数** - - `setup` ([Request](#Request)) - **返回** - - AsyncGenerator[[WebSocket](#WebSocket), None] ## _class_ `WebSocketServerSetup()` {#WebSocketServerSetup} @@ -574,19 +520,14 @@ description: nonebot.drivers 模块 - **重载** **1.** `(driver) -> type[D]` - - **参数** - - `driver` (type[D]) - **返回** - - type[D] **2.** `(driver, __m, /, *mixins) -> type[CombinedDriver]` - - **参数** - - `driver` (type[D]) - `__m` (type[[Mixin](#Mixin)]) @@ -594,5 +535,4 @@ description: nonebot.drivers 模块 - `*mixins` (type[[Mixin](#Mixin)]) - **返回** - - type[CombinedDriver] diff --git a/website/versioned_docs/version-2.4.1/api/drivers/none.md b/website/versioned_docs/version-2.4.1/api/drivers/none.md index 5ef1c558..5422d5dc 100644 --- a/website/versioned_docs/version-2.4.1/api/drivers/none.md +++ b/website/versioned_docs/version-2.4.1/api/drivers/none.md @@ -18,7 +18,6 @@ None 驱动适配 - **说明:** None 驱动框架 - **参数** - - `env` ([Env](../config.md#Env)) - `config` ([Config](../config.md#Config)) @@ -40,13 +39,11 @@ None 驱动适配 - **说明:** 启动 none driver - **参数** - - `*args` - `**kwargs` - **返回** - - untyped ### _method_ `exit(force=False)` {#Driver-exit} @@ -54,9 +51,7 @@ None 驱动适配 - **说明:** 退出 none driver - **参数** - - `force` (bool): 强制退出 - **返回** - - untyped diff --git a/website/versioned_docs/version-2.4.1/api/drivers/quart.md b/website/versioned_docs/version-2.4.1/api/drivers/quart.md index 508366fe..dd8dbb35 100644 --- a/website/versioned_docs/version-2.4.1/api/drivers/quart.md +++ b/website/versioned_docs/version-2.4.1/api/drivers/quart.md @@ -68,7 +68,6 @@ pip install nonebot2[quart] - **说明:** Quart 驱动框架 - **参数** - - `env` ([Env](../config.md#Env)) - `config` (NoneBotConfig) @@ -100,21 +99,17 @@ pip install nonebot2[quart] ### _method_ `setup_http_server(setup)` {#Driver-setup-http-server} - **参数** - - `setup` ([HTTPServerSetup](index.md#HTTPServerSetup)) - **返回** - - untyped ### _method_ `setup_websocket_server(setup)` {#Driver-setup-websocket-server} - **参数** - - `setup` ([WebSocketServerSetup](index.md#WebSocketServerSetup)) - **返回** - - None ### _method_ `run(host=None, port=None, *args, app=None, **kwargs)` {#Driver-run} @@ -122,7 +117,6 @@ pip install nonebot2[quart] - **说明:** 使用 `uvicorn` 启动 Quart - **参数** - - `host` (str | None) - `port` (int | None) @@ -134,7 +128,6 @@ pip install nonebot2[quart] - `**kwargs` - **返回** - - untyped ## _class_ `WebSocket(*, request, websocket_ctx)` {#WebSocket} @@ -142,7 +135,6 @@ pip install nonebot2[quart] - **说明:** Quart WebSocket Wrapper - **参数** - - `request` (BaseRequest) - `websocket_ctx` (WebsocketContext) @@ -154,19 +146,16 @@ pip install nonebot2[quart] empty - **返回** - - untyped ### _async method_ `close(code=1000, reason="")` {#WebSocket-close} - **参数** - - `code` (int) - `reason` (str) - **返回** - - untyped ### _async method_ `receive()` {#WebSocket-receive} @@ -176,7 +165,6 @@ pip install nonebot2[quart] empty - **返回** - - str | bytes ### _async method_ `receive_text()` {#WebSocket-receive-text} @@ -186,7 +174,6 @@ pip install nonebot2[quart] empty - **返回** - - str ### _async method_ `receive_bytes()` {#WebSocket-receive-bytes} @@ -196,25 +183,20 @@ pip install nonebot2[quart] empty - **返回** - - bytes ### _async method_ `send_text(data)` {#WebSocket-send-text} - **参数** - - `data` (str) - **返回** - - untyped ### _async method_ `send_bytes(data)` {#WebSocket-send-bytes} - **参数** - - `data` (bytes) - **返回** - - untyped diff --git a/website/versioned_docs/version-2.4.1/api/drivers/websockets.md b/website/versioned_docs/version-2.4.1/api/drivers/websockets.md index fc46e4d7..60019e1c 100644 --- a/website/versioned_docs/version-2.4.1/api/drivers/websockets.md +++ b/website/versioned_docs/version-2.4.1/api/drivers/websockets.md @@ -22,11 +22,9 @@ pip install nonebot2[websockets] ## _def_ `catch_closed(func)` {#catch-closed} - **参数** - - `func` ((P) -> Coroutine[Any, Any, T]) - **返回** - - (P) -> Coroutine[Any, Any, T] ## _class_ `Mixin()` {#Mixin} @@ -40,11 +38,9 @@ pip install nonebot2[websockets] ### _method_ `websocket(setup)` {#Mixin-websocket} - **参数** - - `setup` ([Request](index.md#Request)) - **返回** - - AsyncGenerator[[WebSocket](index.md#WebSocket), None] ## _class_ `WebSocket(*, request, websocket)` {#WebSocket} @@ -52,7 +48,6 @@ pip install nonebot2[websockets] - **说明:** Websockets WebSocket Wrapper - **参数** - - `request` ([Request](index.md#Request)) - `websocket` (WebSocketClientProtocol) @@ -64,19 +59,16 @@ pip install nonebot2[websockets] empty - **返回** - - untyped ### _async method_ `close(code=1000, reason="")` {#WebSocket-close} - **参数** - - `code` (int) - `reason` (str) - **返回** - - untyped ### _async method_ `receive()` {#WebSocket-receive} @@ -86,7 +78,6 @@ pip install nonebot2[websockets] empty - **返回** - - str | bytes ### _async method_ `receive_text()` {#WebSocket-receive-text} @@ -96,7 +87,6 @@ pip install nonebot2[websockets] empty - **返回** - - str ### _async method_ `receive_bytes()` {#WebSocket-receive-bytes} @@ -106,33 +96,27 @@ pip install nonebot2[websockets] empty - **返回** - - bytes ### _async method_ `send_text(data)` {#WebSocket-send-text} - **参数** - - `data` (str) - **返回** - - None ### _async method_ `send_bytes(data)` {#WebSocket-send-bytes} - **参数** - - `data` (bytes) - **返回** - - None ## _class_ `Driver(env, config)` {#Driver} - **参数** - - `env` ([Env](../config.md#Env)) - `config` ([Config](../config.md#Config)) diff --git a/website/versioned_docs/version-2.4.1/api/exception.md b/website/versioned_docs/version-2.4.1/api/exception.md index 823332c4..0365e1fd 100644 --- a/website/versioned_docs/version-2.4.1/api/exception.md +++ b/website/versioned_docs/version-2.4.1/api/exception.md @@ -62,7 +62,6 @@ NoneBotException - **说明:** 指示 NoneBot 应该忽略该事件。可由 PreProcessor 抛出。 - **参数** - - `reason`: 忽略事件的原因 ## _class_ `SkippedException()` {#SkippedException} @@ -101,7 +100,6 @@ NoneBotException - **说明:** 指示 NoneBot 阻止本次 API 调用或修改本次调用返回值,并返回自定义内容。 可由 api hook 抛出。 - **参数** - - `result`: 返回的内容 ## _class_ `StopPropagation()` {#StopPropagation} @@ -200,7 +198,6 @@ NoneBotException - **说明:** 代表 `Adapter` 抛出的异常,所有的 `Adapter` 都要在内部继承自这个 `Exception`。 - **参数** - - `adapter_name`: 标识 adapter ## _class_ `NoLogException()` {#NoLogException} diff --git a/website/versioned_docs/version-2.4.1/api/index.md b/website/versioned_docs/version-2.4.1/api/index.md index aecfab21..56305d35 100644 --- a/website/versioned_docs/version-2.4.1/api/index.md +++ b/website/versioned_docs/version-2.4.1/api/index.md @@ -60,11 +60,9 @@ description: nonebot 模块 empty - **返回** - - [Driver](drivers/index.md#Driver): 全局 [Driver](drivers/index.md#Driver) 对象 - **异常** - - ValueError: 全局 [Driver](drivers/index.md#Driver) 对象尚未初始化 ([nonebot.init](#init) 尚未调用) - **用法** @@ -80,27 +78,20 @@ description: nonebot 模块 - **重载** **1.** `(name) -> Adapter` - - **参数** - - `name` (str): 适配器名称 - **返回** - - [Adapter](adapters/index.md#Adapter): 指定名称的 [Adapter](adapters/index.md#Adapter) 对象 **2.** `(name) -> A` - - **参数** - - `name` (type[A]): 适配器类型 - **返回** - - A: 指定类型的 [Adapter](adapters/index.md#Adapter) 对象 - **异常** - - ValueError: 指定的 [Adapter](adapters/index.md#Adapter) 未注册 - ValueError: 全局 [Driver](drivers/index.md#Driver) 对象尚未初始化 ([nonebot.init](#init) 尚未调用) @@ -121,11 +112,9 @@ description: nonebot 模块 empty - **返回** - - dict[str, [Adapter](adapters/index.md#Adapter)]: 所有 [Adapter](adapters/index.md#Adapter) 实例字典 - **异常** - - ValueError: 全局 [Driver](drivers/index.md#Driver) 对象尚未初始化 ([nonebot.init](#init) 尚未调用) - **用法** @@ -143,11 +132,9 @@ description: nonebot 模块 empty - **返回** - - Any: Server App 对象 - **异常** - - AssertionError: 全局 Driver 对象不是 [ASGIMixin](drivers/index.md#ASGIMixin) 类型 - ValueError: 全局 [Driver](drivers/index.md#Driver) 对象尚未初始化 ([nonebot.init](#init) 尚未调用) @@ -167,11 +154,9 @@ description: nonebot 模块 empty - **返回** - - Any: ASGI 对象 - **异常** - - AssertionError: 全局 Driver 对象不是 [ASGIMixin](drivers/index.md#ASGIMixin) 类型 - ValueError: 全局 [Driver](drivers/index.md#Driver) 对象尚未初始化 ([nonebot.init](#init) 尚未调用) @@ -192,15 +177,12 @@ description: nonebot 模块 当不提供时,返回一个 [Bot](adapters/index.md#Bot)。 - **参数** - - `self_id` (str | None): 用来识别 [Bot](adapters/index.md#Bot) 的 [Bot.self_id](adapters/index.md#Bot-self-id) 属性 - **返回** - - [Bot](adapters/index.md#Bot): [Bot](adapters/index.md#Bot) 对象 - **异常** - - KeyError: 对应 self_id 的 Bot 不存在 - ValueError: 没有传入 self_id 且没有 Bot 可用 @@ -224,13 +206,11 @@ description: nonebot 模块 empty - **返回** - - dict[str, [Bot](adapters/index.md#Bot)]: 一个以 [Bot.self_id](adapters/index.md#Bot-self-id) 为键 [Bot](adapters/index.md#Bot) 对象为值的字典 - **异常** - - ValueError: 全局 [Driver](drivers/index.md#Driver) 对象尚未初始化 ([nonebot.init](#init) 尚未调用) - **用法** @@ -250,13 +230,11 @@ description: nonebot 模块 也可以传入自定义的 `_env_file` 来指定 NoneBot 从该文件读取配置。 - **参数** - - `_env_file` (DOTENV_TYPE | None): 配置文件名,默认从 `.env.{env_name}` 中读取配置 - `**kwargs` (Any): 任意变量,将会存储到 [Driver.config](drivers/index.md#Driver-config) 对象里 - **返回** - - None - **用法** @@ -270,13 +248,11 @@ description: nonebot 模块 - **说明:** 启动 NoneBot,即运行全局 [Driver](drivers/index.md#Driver) 对象。 - **参数** - - `*args` (Any): 传入 [Driver.run](drivers/index.md#Driver-run) 的位置参数 - `**kwargs` (Any): 传入 [Driver.run](drivers/index.md#Driver-run) 的命名参数 - **返回** - - None - **用法** diff --git a/website/versioned_docs/version-2.4.1/api/log.md b/website/versioned_docs/version-2.4.1/api/log.md index 18bf08d6..636847e5 100644 --- a/website/versioned_docs/version-2.4.1/api/log.md +++ b/website/versioned_docs/version-2.4.1/api/log.md @@ -25,7 +25,6 @@ NoneBot 使用 [`loguru`][loguru] 来记录日志信息。 NoneBot 日志记录器对象。 默认信息: - - 格式: `[%(asctime)s %(name)s] %(levelname)s: %(message)s` - 等级: `INFO` ,根据 `config.log_level` 配置改变 - 输出: 输出至 stdout @@ -47,11 +46,9 @@ NoneBot 使用 [`loguru`][loguru] 来记录日志信息。 ### _method_ `emit(record)` {#LoguruHandler-emit} - **参数** - - `record` (logging.LogRecord) - **返回** - - untyped ## _def_ `default_filter(record)` {#default-filter} @@ -59,11 +56,9 @@ NoneBot 使用 [`loguru`][loguru] 来记录日志信息。 - **说明:** 默认的日志过滤器,根据 `config.log_level` 配置改变日志等级。 - **参数** - - `record` (Record) - **返回** - - untyped ## _var_ `default_format` {#default-format} diff --git a/website/versioned_docs/version-2.4.1/api/matcher.md b/website/versioned_docs/version-2.4.1/api/matcher.md index 3b745786..6f0cc08b 100644 --- a/website/versioned_docs/version-2.4.1/api/matcher.md +++ b/website/versioned_docs/version-2.4.1/api/matcher.md @@ -76,7 +76,6 @@ description: nonebot.matcher 模块 - **说明:** 创建一个新的事件响应器,并存储至 `matchers <#matchers>`\_ - **参数** - - `type_` (str): 事件响应器类型,与 `event.get_type()` 一致时触发,空字符串表示任意 - `rule` ([Rule](rule.md#Rule) | None): 匹配规则 @@ -106,7 +105,6 @@ description: nonebot.matcher 模块 - `default_permission_updater` ([T_PermissionUpdater](typing.md#T-PermissionUpdater) | [Dependent](dependencies/index.md#Dependent)[[Permission](permission.md#Permission)] | None): 默认会话权限更新函数 - **返回** - - type[Matcher]: 新的事件响应器类 ### _classmethod_ `destroy()` {#Matcher-destroy} @@ -118,7 +116,6 @@ description: nonebot.matcher 模块 empty - **返回** - - None ### _classmethod_ `check_perm(bot, event, stack=None, dependency_cache=None)` {#Matcher-check-perm} @@ -126,7 +123,6 @@ description: nonebot.matcher 模块 - **说明:** 检查是否满足触发权限 - **参数** - - `bot` ([Bot](adapters/index.md#Bot)): Bot 对象 - `event` ([Event](adapters/index.md#Event)): 上报事件 @@ -136,7 +132,6 @@ description: nonebot.matcher 模块 - `dependency_cache` ([T_DependencyCache](typing.md#T-DependencyCache) | None): 依赖缓存 - **返回** - - bool: 是否满足权限 ### _classmethod_ `check_rule(bot, event, state, stack=None, dependency_cache=None)` {#Matcher-check-rule} @@ -144,7 +139,6 @@ description: nonebot.matcher 模块 - **说明:** 检查是否满足匹配规则 - **参数** - - `bot` ([Bot](adapters/index.md#Bot)): Bot 对象 - `event` ([Event](adapters/index.md#Event)): 上报事件 @@ -156,7 +150,6 @@ description: nonebot.matcher 模块 - `dependency_cache` ([T_DependencyCache](typing.md#T-DependencyCache) | None): 依赖缓存 - **返回** - - bool: 是否满足匹配规则 ### _classmethod_ `type_updater(func)` {#Matcher-type-updater} @@ -164,11 +157,9 @@ description: nonebot.matcher 模块 - **说明:** 装饰一个函数来更改当前事件响应器的默认响应事件类型更新函数 - **参数** - - `func` ([T_TypeUpdater](typing.md#T-TypeUpdater)): 响应事件类型更新函数 - **返回** - - [T_TypeUpdater](typing.md#T-TypeUpdater) ### _classmethod_ `permission_updater(func)` {#Matcher-permission-updater} @@ -176,23 +167,19 @@ description: nonebot.matcher 模块 - **说明:** 装饰一个函数来更改当前事件响应器的默认会话权限更新函数 - **参数** - - `func` ([T_PermissionUpdater](typing.md#T-PermissionUpdater)): 会话权限更新函数 - **返回** - - [T_PermissionUpdater](typing.md#T-PermissionUpdater) ### _classmethod_ `append_handler(handler, parameterless=None)` {#Matcher-append-handler} - **参数** - - `handler` ([T_Handler](typing.md#T-Handler)) - `parameterless` (Iterable[Any] | None) - **返回** - - [Dependent](dependencies/index.md#Dependent)[Any] ### _classmethod_ `handle(parameterless=None)` {#Matcher-handle} @@ -200,11 +187,9 @@ description: nonebot.matcher 模块 - **说明:** 装饰一个函数来向事件响应器直接添加一个处理函数 - **参数** - - `parameterless` (Iterable[Any] | None): 非参数类型依赖列表 - **返回** - - ([T_Handler](typing.md#T-Handler)) -> [T_Handler](typing.md#T-Handler) ### _classmethod_ `receive(id="", parameterless=None)` {#Matcher-receive} @@ -212,13 +197,11 @@ description: nonebot.matcher 模块 - **说明:** 装饰一个函数来指示 NoneBot 在接收用户新的一条消息后继续运行该函数 - **参数** - - `id` (str): 消息 ID - `parameterless` (Iterable[Any] | None): 非参数类型依赖列表 - **返回** - - ([T_Handler](typing.md#T-Handler)) -> [T_Handler](typing.md#T-Handler) ### _classmethod_ `got(key, prompt=None, parameterless=None)` {#Matcher-got} @@ -231,7 +214,6 @@ description: nonebot.matcher 模块 如果 `key` 已存在则直接继续运行 - **参数** - - `key` (str): 参数名 - `prompt` (str | [Message](adapters/index.md#Message) | [MessageSegment](adapters/index.md#MessageSegment) | [MessageTemplate](adapters/index.md#MessageTemplate) | None): 在参数不存在时向用户发送的消息 @@ -239,7 +221,6 @@ description: nonebot.matcher 模块 - `parameterless` (Iterable[Any] | None): 非参数类型依赖列表 - **返回** - - ([T_Handler](typing.md#T-Handler)) -> [T_Handler](typing.md#T-Handler) ### _classmethod_ `send(message, **kwargs)` {#Matcher-send} @@ -247,13 +228,11 @@ description: nonebot.matcher 模块 - **说明:** 发送一条消息给当前交互用户 - **参数** - - `message` (str | [Message](adapters/index.md#Message) | [MessageSegment](adapters/index.md#MessageSegment) | [MessageTemplate](adapters/index.md#MessageTemplate)): 消息内容 - `**kwargs` (Any): [Bot.send](adapters/index.md#Bot-send) 的参数, 请参考对应 adapter 的 bot 对象 api - **返回** - - Any ### _classmethod_ `finish(message=None, **kwargs)` {#Matcher-finish} @@ -261,13 +240,11 @@ description: nonebot.matcher 模块 - **说明:** 发送一条消息给当前交互用户并结束当前事件响应器 - **参数** - - `message` (str | [Message](adapters/index.md#Message) | [MessageSegment](adapters/index.md#MessageSegment) | [MessageTemplate](adapters/index.md#MessageTemplate) | None): 消息内容 - `**kwargs`: [Bot.send](adapters/index.md#Bot-send) 的参数, 请参考对应 adapter 的 bot 对象 api - **返回** - - NoReturn ### _classmethod_ `pause(prompt=None, **kwargs)` {#Matcher-pause} @@ -275,13 +252,11 @@ description: nonebot.matcher 模块 - **说明:** 发送一条消息给当前交互用户并暂停事件响应器,在接收用户新的一条消息后继续下一个处理函数 - **参数** - - `prompt` (str | [Message](adapters/index.md#Message) | [MessageSegment](adapters/index.md#MessageSegment) | [MessageTemplate](adapters/index.md#MessageTemplate) | None): 消息内容 - `**kwargs`: [Bot.send](adapters/index.md#Bot-send) 的参数, 请参考对应 adapter 的 bot 对象 api - **返回** - - NoReturn ### _classmethod_ `reject(prompt=None, **kwargs)` {#Matcher-reject} @@ -289,13 +264,11 @@ description: nonebot.matcher 模块 - **说明:** 最近使用 `got` / `receive` 接收的消息不符合预期, 发送一条消息给当前交互用户并将当前事件处理流程中断在当前位置,在接收用户新的一个事件后从头开始执行当前处理函数 - **参数** - - `prompt` (str | [Message](adapters/index.md#Message) | [MessageSegment](adapters/index.md#MessageSegment) | [MessageTemplate](adapters/index.md#MessageTemplate) | None): 消息内容 - `**kwargs`: [Bot.send](adapters/index.md#Bot-send) 的参数, 请参考对应 adapter 的 bot 对象 api - **返回** - - NoReturn ### _classmethod_ `reject_arg(key, prompt=None, **kwargs)` {#Matcher-reject-arg} @@ -303,7 +276,6 @@ description: nonebot.matcher 模块 - **说明:** 最近使用 `got` 接收的消息不符合预期, 发送一条消息给当前交互用户并将当前事件处理流程中断在当前位置,在接收用户新的一条消息后从头开始执行当前处理函数 - **参数** - - `key` (str): 参数名 - `prompt` (str | [Message](adapters/index.md#Message) | [MessageSegment](adapters/index.md#MessageSegment) | [MessageTemplate](adapters/index.md#MessageTemplate) | None): 消息内容 @@ -311,7 +283,6 @@ description: nonebot.matcher 模块 - `**kwargs`: [Bot.send](adapters/index.md#Bot-send) 的参数, 请参考对应 adapter 的 bot 对象 api - **返回** - - NoReturn ### _classmethod_ `reject_receive(id="", prompt=None, **kwargs)` {#Matcher-reject-receive} @@ -319,7 +290,6 @@ description: nonebot.matcher 模块 - **说明:** 最近使用 `receive` 接收的消息不符合预期, 发送一条消息给当前交互用户并将当前事件处理流程中断在当前位置,在接收用户新的一个事件后从头开始执行当前处理函数 - **参数** - - `id` (str): 消息 id - `prompt` (str | [Message](adapters/index.md#Message) | [MessageSegment](adapters/index.md#MessageSegment) | [MessageTemplate](adapters/index.md#MessageTemplate) | None): 消息内容 @@ -327,7 +297,6 @@ description: nonebot.matcher 模块 - `**kwargs`: [Bot.send](adapters/index.md#Bot-send) 的参数, 请参考对应 adapter 的 bot 对象 api - **返回** - - NoReturn ### _classmethod_ `skip()` {#Matcher-skip} @@ -343,7 +312,6 @@ description: nonebot.matcher 模块 empty - **返回** - - NoReturn ### _method_ `get_receive(id, default=None)` {#Matcher-get-receive} @@ -357,25 +325,19 @@ description: nonebot.matcher 模块 - **重载** **1.** `(id) -> Event | None` - - **参数** - - `id` (str) - **返回** - - [Event](adapters/index.md#Event) | None **2.** `(id, default) -> Event | T` - - **参数** - - `id` (str) - `default` (T) - **返回** - - [Event](adapters/index.md#Event) | T ### _method_ `set_receive(id, event)` {#Matcher-set-receive} @@ -383,13 +345,11 @@ description: nonebot.matcher 模块 - **说明:** 设置一个 `receive` 事件 - **参数** - - `id` (str) - `event` ([Event](adapters/index.md#Event)) - **返回** - - None ### _method_ `get_last_receive(default=None)` {#Matcher-get-last-receive} @@ -403,23 +363,18 @@ description: nonebot.matcher 模块 - **重载** **1.** `() -> Event | None` - - **参数** empty - **返回** - - [Event](adapters/index.md#Event) | None **2.** `(default) -> Event | T` - - **参数** - - `default` (T) - **返回** - - [Event](adapters/index.md#Event) | T ### _method_ `get_arg(key, default=None)` {#Matcher-get-arg} @@ -433,25 +388,19 @@ description: nonebot.matcher 模块 - **重载** **1.** `(key) -> Message | None` - - **参数** - - `key` (str) - **返回** - - [Message](adapters/index.md#Message) | None **2.** `(key, default) -> Message | T` - - **参数** - - `key` (str) - `default` (T) - **返回** - - [Message](adapters/index.md#Message) | T ### _method_ `set_arg(key, message)` {#Matcher-set-arg} @@ -459,25 +408,21 @@ description: nonebot.matcher 模块 - **说明:** 设置一个 `got` 消息 - **参数** - - `key` (str) - `message` ([Message](adapters/index.md#Message)) - **返回** - - None ### _method_ `set_target(target, cache=True)` {#Matcher-set-target} - **参数** - - `target` (str) - `cache` (bool) - **返回** - - None ### _method_ `get_target(default=None)` {#Matcher-get-target} @@ -485,23 +430,18 @@ description: nonebot.matcher 模块 - **重载** **1.** `() -> str | None` - - **参数** empty - **返回** - - str | None **2.** `(default) -> str | T` - - **参数** - - `default` (T) - **返回** - - str | T ### _method_ `stop_propagation()` {#Matcher-stop-propagation} @@ -513,13 +453,11 @@ description: nonebot.matcher 模块 empty - **返回** - - untyped ### _async method_ `update_type(bot, event, stack=None, dependency_cache=None)` {#Matcher-update-type} - **参数** - - `bot` ([Bot](adapters/index.md#Bot)) - `event` ([Event](adapters/index.md#Event)) @@ -529,13 +467,11 @@ description: nonebot.matcher 模块 - `dependency_cache` ([T_DependencyCache](typing.md#T-DependencyCache) | None) - **返回** - - str ### _async method_ `update_permission(bot, event, stack=None, dependency_cache=None)` {#Matcher-update-permission} - **参数** - - `bot` ([Bot](adapters/index.md#Bot)) - `event` ([Event](adapters/index.md#Event)) @@ -545,7 +481,6 @@ description: nonebot.matcher 模块 - `dependency_cache` ([T_DependencyCache](typing.md#T-DependencyCache) | None) - **返回** - - [Permission](permission.md#Permission) ### _async method_ `resolve_reject()` {#Matcher-resolve-reject} @@ -555,25 +490,21 @@ description: nonebot.matcher 模块 empty - **返回** - - untyped ### _method_ `ensure_context(bot, event)` {#Matcher-ensure-context} - **参数** - - `bot` ([Bot](adapters/index.md#Bot)) - `event` ([Event](adapters/index.md#Event)) - **返回** - - untyped ### _async method_ `simple_run(bot, event, state, stack=None, dependency_cache=None)` {#Matcher-simple-run} - **参数** - - `bot` ([Bot](adapters/index.md#Bot)) - `event` ([Event](adapters/index.md#Event)) @@ -585,13 +516,11 @@ description: nonebot.matcher 模块 - `dependency_cache` ([T_DependencyCache](typing.md#T-DependencyCache) | None) - **返回** - - untyped ### _async method_ `run(bot, event, state, stack=None, dependency_cache=None)` {#Matcher-run} - **参数** - - `bot` ([Bot](adapters/index.md#Bot)) - `event` ([Event](adapters/index.md#Event)) @@ -603,7 +532,6 @@ description: nonebot.matcher 模块 - `dependency_cache` ([T_DependencyCache](typing.md#T-DependencyCache) | None) - **返回** - - untyped ## _class_ `MatcherManager()` {#MatcherManager} @@ -625,7 +553,6 @@ description: nonebot.matcher 模块 empty - **返回** - - KeysView[int] ### _method_ `values()` {#MatcherManager-values} @@ -635,7 +562,6 @@ description: nonebot.matcher 模块 empty - **返回** - - ValuesView[list[type[[Matcher](#Matcher)]]] ### _method_ `items()` {#MatcherManager-items} @@ -645,7 +571,6 @@ description: nonebot.matcher 模块 empty - **返回** - - ItemsView[int, list[type[[Matcher](#Matcher)]]] ### _method_ `get(key, default=None)` {#MatcherManager-get} @@ -653,35 +578,27 @@ description: nonebot.matcher 模块 - **重载** **1.** `(key) -> list[type[Matcher]] | None` - - **参数** - - `key` (int) - **返回** - - list[type[[Matcher](#Matcher)]] | None **2.** `(key, default) -> list[type[Matcher]] | T` - - **参数** - - `key` (int) - `default` (T) - **返回** - - list[type[[Matcher](#Matcher)]] | T ### _method_ `pop(key)` {#MatcherManager-pop} - **参数** - - `key` (int) - **返回** - - list[type[[Matcher](#Matcher)]] ### _method_ `popitem()` {#MatcherManager-popitem} @@ -691,7 +608,6 @@ description: nonebot.matcher 模块 empty - **返回** - - tuple[int, list[type[[Matcher](#Matcher)]]] ### _method_ `clear()` {#MatcherManager-clear} @@ -701,29 +617,24 @@ description: nonebot.matcher 模块 empty - **返回** - - None ### _method_ `update(m, /)` {#MatcherManager-update} - **参数** - - `m` (MutableMapping[int, list[type[[Matcher](#Matcher)]]]) - **返回** - - None ### _method_ `setdefault(key, default)` {#MatcherManager-setdefault} - **参数** - - `key` (int) - `default` (list[type[[Matcher](#Matcher)]]) - **返回** - - list[type[[Matcher](#Matcher)]] ### _method_ `set_provider(provider_class)` {#MatcherManager-set-provider} @@ -731,11 +642,9 @@ description: nonebot.matcher 模块 - **说明:** 设置事件响应器存储器 - **参数** - - `provider_class` (type[[MatcherProvider](#MatcherProvider)]): 事件响应器存储器类 - **返回** - - None ## _abstract class_ `MatcherProvider(matchers)` {#MatcherProvider} @@ -743,7 +652,6 @@ description: nonebot.matcher 模块 - **说明:** 事件响应器存储器基类 - **参数** - - `matchers` (Mapping[int, list[type[[Matcher](#Matcher)]]]): 当前存储器中已有的事件响应器 ## _var_ `matchers` {#matchers} diff --git a/website/versioned_docs/version-2.4.1/api/message.md b/website/versioned_docs/version-2.4.1/api/message.md index 73622df3..ad785e3d 100644 --- a/website/versioned_docs/version-2.4.1/api/message.md +++ b/website/versioned_docs/version-2.4.1/api/message.md @@ -20,11 +20,9 @@ NoneBot 内部处理并按优先级分发事件给所有事件响应器,提供 装饰一个函数,使它在每次接收到事件并分发给各响应器之前执行。 - **参数** - - `func` ([T_EventPreProcessor](typing.md#T-EventPreProcessor)) - **返回** - - [T_EventPreProcessor](typing.md#T-EventPreProcessor) ## _def_ `event_postprocessor(func)` {#event-postprocessor} @@ -36,11 +34,9 @@ NoneBot 内部处理并按优先级分发事件给所有事件响应器,提供 装饰一个函数,使它在每次接收到事件并分发给各响应器之后执行。 - **参数** - - `func` ([T_EventPostProcessor](typing.md#T-EventPostProcessor)) - **返回** - - [T_EventPostProcessor](typing.md#T-EventPostProcessor) ## _def_ `run_preprocessor(func)` {#run-preprocessor} @@ -52,11 +48,9 @@ NoneBot 内部处理并按优先级分发事件给所有事件响应器,提供 装饰一个函数,使它在每次事件响应器运行前执行。 - **参数** - - `func` ([T_RunPreProcessor](typing.md#T-RunPreProcessor)) - **返回** - - [T_RunPreProcessor](typing.md#T-RunPreProcessor) ## _def_ `run_postprocessor(func)` {#run-postprocessor} @@ -68,11 +62,9 @@ NoneBot 内部处理并按优先级分发事件给所有事件响应器,提供 装饰一个函数,使它在每次事件响应器运行后执行。 - **参数** - - `func` ([T_RunPostProcessor](typing.md#T-RunPostProcessor)) - **返回** - - [T_RunPostProcessor](typing.md#T-RunPostProcessor) ## _async def_ `check_and_run_matcher(Matcher, bot, event, state, stack=None, dependency_cache=None)` {#check-and-run-matcher} @@ -80,7 +72,6 @@ NoneBot 内部处理并按优先级分发事件给所有事件响应器,提供 - **说明:** 检查并运行事件响应器。 - **参数** - - `Matcher` (type[[Matcher](matcher.md#Matcher)]): 事件响应器 - `bot` ([Bot](adapters/index.md#Bot)): Bot 对象 @@ -94,7 +85,6 @@ NoneBot 内部处理并按优先级分发事件给所有事件响应器,提供 - `dependency_cache` ([T_DependencyCache](typing.md#T-DependencyCache) | None): 依赖缓存 - **返回** - - None ## _async def_ `handle_event(bot, event)` {#handle-event} @@ -102,13 +92,11 @@ NoneBot 内部处理并按优先级分发事件给所有事件响应器,提供 - **说明:** 处理一个事件。调用该函数以实现分发事件。 - **参数** - - `bot` ([Bot](adapters/index.md#Bot)): Bot 对象 - `event` ([Event](adapters/index.md#Event)): Event 对象 - **返回** - - None - **用法** diff --git a/website/versioned_docs/version-2.4.1/api/params.md b/website/versioned_docs/version-2.4.1/api/params.md index 0af076cb..9f5775c0 100644 --- a/website/versioned_docs/version-2.4.1/api/params.md +++ b/website/versioned_docs/version-2.4.1/api/params.md @@ -14,11 +14,9 @@ description: nonebot.params 模块 - **说明:** Arg 参数消息 - **参数** - - `key` (str | None) - **返回** - - Any ## _class_ `ArgParam(*args, key, type, **kwargs)` {#ArgParam} @@ -33,7 +31,6 @@ description: nonebot.params 模块 留空则会根据参数名称获取。 - **参数** - - `*args` - `key` (str) @@ -47,11 +44,9 @@ description: nonebot.params 模块 - **说明:** Arg 参数消息纯文本 - **参数** - - `key` (str | None) - **返回** - - str ## _def_ `ArgPromptResult(key=None)` {#ArgPromptResult} @@ -59,11 +54,9 @@ description: nonebot.params 模块 - **说明:** `arg` prompt 发送结果 - **参数** - - `key` (str | None) - **返回** - - Any ## _def_ `ArgStr(key=None)` {#ArgStr} @@ -71,11 +64,9 @@ description: nonebot.params 模块 - **说明:** Arg 参数消息文本 - **参数** - - `key` (str | None) - **返回** - - str ## _class_ `BotParam(*args, checker=None, **kwargs)` {#BotParam} @@ -89,7 +80,6 @@ description: nonebot.params 模块 为保证兼容性,本注入还会解析名为 `bot` 且没有类型注解的参数。 - **参数** - - `*args` - `checker` ([ModelField](compat.md#ModelField) | None) @@ -107,7 +97,6 @@ description: nonebot.params 模块 本注入参数应该具有最低优先级,因此应该在所有其他注入参数之后使用。 - **参数** - - `*args` - `validate` (bool) @@ -125,7 +114,6 @@ description: nonebot.params 模块 本注入应该具有最高优先级,因此应该在其他参数之前检查。 - **参数** - - `*args` - `dependent` ([Dependent](dependencies/index.md#Dependent)[Any]) @@ -139,7 +127,6 @@ description: nonebot.params 模块 - **说明:** 子依赖装饰器 - **参数** - - `dependency` ([T_Handler](typing.md#T-Handler) | None): 依赖函数。默认为参数的类型注释。 - `use_cache` (bool): 是否使用缓存。默认为 `True`。 @@ -147,7 +134,6 @@ description: nonebot.params 模块 - `validate` (bool | PydanticFieldInfo): 是否使用 Pydantic 类型校验。默认为 `False`。 - **返回** - - Any - **用法** @@ -180,7 +166,6 @@ description: nonebot.params 模块 为保证兼容性,本注入还会解析名为 `event` 且没有类型注解的参数。 - **参数** - - `*args` - `checker` ([ModelField](compat.md#ModelField) | None) @@ -198,7 +183,6 @@ description: nonebot.params 模块 为保证兼容性,本注入还会解析名为 `exception` 且没有类型注解的参数。 - **参数** - - `*args` - `validate` (bool) @@ -216,7 +200,6 @@ description: nonebot.params 模块 为保证兼容性,本注入还会解析名为 `matcher` 且没有类型注解的参数。 - **参数** - - `*args` - `checker` ([ModelField](compat.md#ModelField) | None) @@ -234,7 +217,6 @@ description: nonebot.params 模块 为保证兼容性,本注入还会解析名为 `state` 且没有类型注解的参数。 - **参数** - - `*args` - `validate` (bool) @@ -250,7 +232,6 @@ description: nonebot.params 模块 empty - **返回** - - str ## _def_ `EventMessage()` {#EventMessage} @@ -262,7 +243,6 @@ description: nonebot.params 模块 empty - **返回** - - Any ## _def_ `EventPlainText()` {#EventPlainText} @@ -274,7 +254,6 @@ description: nonebot.params 模块 empty - **返回** - - str ## _def_ `EventToMe()` {#EventToMe} @@ -286,7 +265,6 @@ description: nonebot.params 模块 empty - **返回** - - bool ## _def_ `Command()` {#Command} @@ -298,7 +276,6 @@ description: nonebot.params 模块 empty - **返回** - - tuple[str, ...] ## _def_ `RawCommand()` {#RawCommand} @@ -310,7 +287,6 @@ description: nonebot.params 模块 empty - **返回** - - str ## _def_ `CommandArg()` {#CommandArg} @@ -322,7 +298,6 @@ description: nonebot.params 模块 empty - **返回** - - Any ## _def_ `CommandStart()` {#CommandStart} @@ -334,7 +309,6 @@ description: nonebot.params 模块 empty - **返回** - - str ## _def_ `CommandWhitespace()` {#CommandWhitespace} @@ -346,7 +320,6 @@ description: nonebot.params 模块 empty - **返回** - - str ## _def_ `ShellCommandArgs()` {#ShellCommandArgs} @@ -358,7 +331,6 @@ description: nonebot.params 模块 empty - **返回** - - Any ## _def_ `ShellCommandArgv()` {#ShellCommandArgv} @@ -370,7 +342,6 @@ description: nonebot.params 模块 empty - **返回** - - Any ## _def_ `RegexMatched()` {#RegexMatched} @@ -382,7 +353,6 @@ description: nonebot.params 模块 empty - **返回** - - Match[str] ## _def_ `RegexStr(*groups)` {#RegexStr} @@ -392,29 +362,21 @@ description: nonebot.params 模块 - **重载** **1.** `(group, /) -> str` - - **参数** - - `group` (Literal[0]) - **返回** - - str **2.** `(group, /) -> str | Any` - - **参数** - - `group` (str | int) - **返回** - - str | Any **3.** `(group1, group2, /, *groups) -> tuple[str | Any, ...]` - - **参数** - - `group1` (str | int) - `group2` (str | int) @@ -422,7 +384,6 @@ description: nonebot.params 模块 - `*groups` (str | int) - **返回** - - tuple[str | Any, ...] ## _def_ `RegexGroup()` {#RegexGroup} @@ -434,7 +395,6 @@ description: nonebot.params 模块 empty - **返回** - - tuple[Any, ...] ## _def_ `RegexDict()` {#RegexDict} @@ -446,7 +406,6 @@ description: nonebot.params 模块 empty - **返回** - - dict[str, Any] ## _def_ `Startswith()` {#Startswith} @@ -458,7 +417,6 @@ description: nonebot.params 模块 empty - **返回** - - str ## _def_ `Endswith()` {#Endswith} @@ -470,7 +428,6 @@ description: nonebot.params 模块 empty - **返回** - - str ## _def_ `Fullmatch()` {#Fullmatch} @@ -482,7 +439,6 @@ description: nonebot.params 模块 empty - **返回** - - str ## _def_ `Keyword()` {#Keyword} @@ -494,7 +450,6 @@ description: nonebot.params 模块 empty - **返回** - - str ## _def_ `Received(id=None, default=None)` {#Received} @@ -502,13 +457,11 @@ description: nonebot.params 模块 - **说明:** `receive` 事件参数 - **参数** - - `id` (str | None) - `default` (Any) - **返回** - - Any ## _def_ `LastReceived(default=None)` {#LastReceived} @@ -516,11 +469,9 @@ description: nonebot.params 模块 - **说明:** `last_receive` 事件参数 - **参数** - - `default` (Any) - **返回** - - Any ## _def_ `ReceivePromptResult(id=None)` {#ReceivePromptResult} @@ -528,11 +479,9 @@ description: nonebot.params 模块 - **说明:** `receive` prompt 发送结果 - **参数** - - `id` (str | None) - **返回** - - Any ## _def_ `PausePromptResult()` {#PausePromptResult} @@ -544,5 +493,4 @@ description: nonebot.params 模块 empty - **返回** - - Any diff --git a/website/versioned_docs/version-2.4.1/api/permission.md b/website/versioned_docs/version-2.4.1/api/permission.md index a5df96c9..ac4775a8 100644 --- a/website/versioned_docs/version-2.4.1/api/permission.md +++ b/website/versioned_docs/version-2.4.1/api/permission.md @@ -22,7 +22,6 @@ description: nonebot.permission 模块 如果 `perm` 中仅有 `User` 类型的权限检查函数,则会去除原有检查函数的会话 ID 限制。 - **参数** - - `*users` (str) - `perm` (Permission | None): 需要同时满足的权限 @@ -30,7 +29,6 @@ description: nonebot.permission 模块 - `user`: 会话白名单 - **返回** - - untyped ## _class_ `Permission(*checkers)` {#Permission} @@ -42,7 +40,6 @@ description: nonebot.permission 模块 当事件传递时,在 [Matcher](matcher.md#Matcher) 运行前进行检查。 - **参数** - - `*checkers` ([T_PermissionChecker](typing.md#T-PermissionChecker) | [Dependent](dependencies/index.md#Dependent)[bool]): PermissionChecker - **用法** @@ -64,7 +61,6 @@ description: nonebot.permission 模块 - **说明:** 检查是否满足某个权限。 - **参数** - - `bot` ([Bot](adapters/index.md#Bot)): Bot 对象 - `event` ([Event](adapters/index.md#Event)): Event 对象 @@ -74,7 +70,6 @@ description: nonebot.permission 模块 - `dependency_cache` ([T_DependencyCache](typing.md#T-DependencyCache) | None): 依赖缓存 - **返回** - - bool ## _class_ `User(users, perm=None)` {#User} @@ -82,7 +77,6 @@ description: nonebot.permission 模块 - **说明:** 检查当前事件是否属于指定会话。 - **参数** - - `users` (tuple[str, ...]): 会话 ID 元组 - `perm` (Permission | None): 需同时满足的权限 @@ -96,13 +90,11 @@ description: nonebot.permission 模块 如果 `perm` 中仅有 `User` 类型的权限检查函数,则会去除原有的会话 ID 限制。 - **参数** - - `event` ([Event](adapters/index.md#Event)): Event 对象 - `perm` (Permission | None): 需同时满足的权限 - **返回** - - Self ### _classmethod_ `from_permission(*users, perm=None)` {#User-from-permission} @@ -114,13 +106,11 @@ description: nonebot.permission 模块 如果 `perm` 中仅有 `User` 类型的权限检查函数,则会去除原有的会话 ID 限制。 - **参数** - - `*users` (str): 会话白名单 - `perm` (Permission | None): 需同时满足的权限 - **返回** - - Self ## _class_ `Message()` {#Message} diff --git a/website/versioned_docs/version-2.4.1/api/plugin/index.md b/website/versioned_docs/version-2.4.1/api/plugin/index.md index 68c66d99..66acdfbb 100644 --- a/website/versioned_docs/version-2.4.1/api/plugin/index.md +++ b/website/versioned_docs/version-2.4.1/api/plugin/index.md @@ -51,11 +51,9 @@ description: nonebot.plugin 模块 如果为嵌套的子插件,标识符为 `父插件标识符:子插件文件(夹)名`。 - **参数** - - `plugin_id` (str): 插件标识符,即 [Plugin.id\_](model.md#Plugin-id-)。 - **返回** - - [Plugin](model.md#Plugin) | None ## _def_ `get_plugin_by_module_name(module_name)` {#get-plugin-by-module-name} @@ -67,11 +65,9 @@ description: nonebot.plugin 模块 如果提供的模块名为某个插件的子模块,同样会返回该插件。 - **参数** - - `module_name` (str): 模块名,即 [Plugin.module_name](model.md#Plugin-module-name)。 - **返回** - - [Plugin](model.md#Plugin) | None ## _def_ `get_loaded_plugins()` {#get-loaded-plugins} @@ -83,7 +79,6 @@ description: nonebot.plugin 模块 empty - **返回** - - set[[Plugin](model.md#Plugin)] ## _def_ `get_available_plugin_names()` {#get-available-plugin-names} @@ -95,7 +90,6 @@ description: nonebot.plugin 模块 empty - **返回** - - set[str] ## _def_ `get_plugin_config(config)` {#get-plugin-config} @@ -103,9 +97,7 @@ description: nonebot.plugin 模块 - **说明:** 从全局配置获取当前插件需要的配置项。 - **参数** - - `config` (type[C]) - **返回** - - C diff --git a/website/versioned_docs/version-2.4.1/api/plugin/load.md b/website/versioned_docs/version-2.4.1/api/plugin/load.md index 5c2a5a12..0fb7328f 100644 --- a/website/versioned_docs/version-2.4.1/api/plugin/load.md +++ b/website/versioned_docs/version-2.4.1/api/plugin/load.md @@ -14,11 +14,9 @@ description: nonebot.plugin.load 模块 - **说明:** 加载单个插件,可以是本地插件或是通过 `pip` 安装的插件。 - **参数** - - `module_path` (str | Path): 插件名称 `path.to.your.plugin` 或插件路径 `pathlib.Path(path/to/your/plugin)` - **返回** - - [Plugin](model.md#Plugin) | None ## _def_ `load_plugins(*plugin_dir)` {#load-plugins} @@ -26,11 +24,9 @@ description: nonebot.plugin.load 模块 - **说明:** 导入文件夹下多个插件,以 `_` 开头的插件不会被导入! - **参数** - - `*plugin_dir` (str): 文件夹路径 - **返回** - - set[[Plugin](model.md#Plugin)] ## _def_ `load_all_plugins(module_path, plugin_dir)` {#load-all-plugins} @@ -38,13 +34,11 @@ description: nonebot.plugin.load 模块 - **说明:** 导入指定列表中的插件以及指定目录下多个插件,以 `_` 开头的插件不会被导入! - **参数** - - `module_path` (Iterable[str]): 指定插件集合 - `plugin_dir` (Iterable[str]): 指定文件夹路径集合 - **返回** - - set[[Plugin](model.md#Plugin)] ## _def_ `load_from_json(file_path, encoding="utf-8")` {#load-from-json} @@ -52,13 +46,11 @@ description: nonebot.plugin.load 模块 - **说明:** 导入指定 json 文件中的 `plugins` 以及 `plugin_dirs` 下多个插件。 以 `_` 开头的插件不会被导入! - **参数** - - `file_path` (str): 指定 json 文件路径 - `encoding` (str): 指定 json 文件编码 - **返回** - - set[[Plugin](model.md#Plugin)] - **用法** @@ -79,13 +71,11 @@ description: nonebot.plugin.load 模块 - **说明:** 导入指定 toml 文件 `[tool.nonebot]` 中的 `plugins` 以及 `plugin_dirs` 下多个插件。 以 `_` 开头的插件不会被导入! - **参数** - - `file_path` (str): 指定 toml 文件路径 - `encoding` (str): 指定 toml 文件编码 - **返回** - - set[[Plugin](model.md#Plugin)] - **用法** @@ -105,11 +95,9 @@ description: nonebot.plugin.load 模块 - **说明:** 导入 NoneBot 内置插件。 - **参数** - - `name` (str): 插件名称 - **返回** - - [Plugin](model.md#Plugin) | None ## _def_ `load_builtin_plugins(*plugins)` {#load-builtin-plugins} @@ -117,11 +105,9 @@ description: nonebot.plugin.load 模块 - **说明:** 导入多个 NoneBot 内置插件。 - **参数** - - `*plugins` (str): 插件名称列表 - **返回** - - set[[Plugin](model.md#Plugin)] ## _def_ `require(name)` {#require} @@ -129,15 +115,12 @@ description: nonebot.plugin.load 模块 - **说明:** 声明依赖插件。 - **参数** - - `name` (str): 插件模块名或插件标识符,仅在已声明插件的情况下可使用标识符。 - **返回** - - ModuleType - **异常** - - RuntimeError: 插件无法加载 ## _def_ `inherit_supported_adapters(*names)` {#inherit-supported-adapters} @@ -149,15 +132,12 @@ description: nonebot.plugin.load 模块 如果传入了多个插件名称,返回值会自动取交集。 - **参数** - - `*names` (str): 插件名称列表。 - **返回** - - set[str] | None - **异常** - - RuntimeError: 插件未加载 - ValueError: 插件缺少元数据 diff --git a/website/versioned_docs/version-2.4.1/api/plugin/manager.md b/website/versioned_docs/version-2.4.1/api/plugin/manager.md index af32a84b..f9cc1da5 100644 --- a/website/versioned_docs/version-2.4.1/api/plugin/manager.md +++ b/website/versioned_docs/version-2.4.1/api/plugin/manager.md @@ -16,7 +16,6 @@ description: nonebot.plugin.manager 模块 - **说明:** 插件管理器。 - **参数** - - `plugins` (Iterable[str] | None): 独立插件模块名集合。 - `search_path` (Iterable[str] | None): 插件搜索路径(文件夹),相对于当前工作目录。 @@ -54,11 +53,9 @@ description: nonebot.plugin.manager 模块 可以使用完整插件模块名或者插件标识符加载。 - **参数** - - `name` (str): 插件名称或插件标识符。 - **返回** - - [Plugin](model.md#Plugin) | None ### _method_ `load_all_plugins()` {#PluginManager-load-all-plugins} @@ -70,7 +67,6 @@ description: nonebot.plugin.manager 模块 empty - **返回** - - set[[Plugin](model.md#Plugin)] ## _class_ `PluginFinder()` {#PluginFinder} @@ -82,7 +78,6 @@ description: nonebot.plugin.manager 模块 ### _method_ `find_spec(fullname, path, target=None)` {#PluginFinder-find-spec} - **参数** - - `fullname` (str) - `path` (Sequence[str] | None) @@ -90,13 +85,11 @@ description: nonebot.plugin.manager 模块 - `target` (ModuleType | None) - **返回** - - untyped ## _class_ `PluginLoader(manager, fullname, path)` {#PluginLoader} - **参数** - - `manager` (PluginManager) - `fullname` (str) @@ -106,19 +99,15 @@ description: nonebot.plugin.manager 模块 ### _method_ `create_module(spec)` {#PluginLoader-create-module} - **参数** - - `spec` - **返回** - - ModuleType | None ### _method_ `exec_module(module)` {#PluginLoader-exec-module} - **参数** - - `module` (ModuleType) - **返回** - - None diff --git a/website/versioned_docs/version-2.4.1/api/plugin/model.md b/website/versioned_docs/version-2.4.1/api/plugin/model.md index c87e6d73..b6f329df 100644 --- a/website/versioned_docs/version-2.4.1/api/plugin/model.md +++ b/website/versioned_docs/version-2.4.1/api/plugin/model.md @@ -80,7 +80,6 @@ description: nonebot.plugin.model 模块 empty - **返回** - - set[type[[Adapter](../adapters/index.md#Adapter)]] | None ## _class_ `Plugin()` {#Plugin} diff --git a/website/versioned_docs/version-2.4.1/api/plugin/on.md b/website/versioned_docs/version-2.4.1/api/plugin/on.md index 638bacaa..06bb3b20 100644 --- a/website/versioned_docs/version-2.4.1/api/plugin/on.md +++ b/website/versioned_docs/version-2.4.1/api/plugin/on.md @@ -14,11 +14,9 @@ description: nonebot.plugin.on 模块 - **说明:** 存储一个事件响应器到插件。 - **参数** - - `matcher` (type[[Matcher](../matcher.md#Matcher)]): 事件响应器 - **返回** - - None ## _def_ `get_matcher_plugin(depth=...)` {#get-matcher-plugin} @@ -30,11 +28,9 @@ description: nonebot.plugin.on 模块 **Deprecated**, 请使用 [get_matcher_source](#get-matcher-source) 获取信息。 - **参数** - - `depth` (int): 调用栈深度 - **返回** - - [Plugin](model.md#Plugin) | None ## _def_ `get_matcher_module(depth=...)` {#get-matcher-module} @@ -46,11 +42,9 @@ description: nonebot.plugin.on 模块 **Deprecated**, 请使用 [get_matcher_source](#get-matcher-source) 获取信息。 - **参数** - - `depth` (int): 调用栈深度 - **返回** - - ModuleType | None ## _def_ `get_matcher_source(depth=...)` {#get-matcher-source} @@ -58,11 +52,9 @@ description: nonebot.plugin.on 模块 - **说明:** 获取事件响应器定义所在源码信息。 - **参数** - - `depth` (int): 调用栈深度 - **返回** - - MatcherSource | None ## _def_ `on(type="", rule=..., permission=..., *, handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on} @@ -70,7 +62,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个基础事件响应器,可自定义类型。 - **参数** - - `type` (str): 事件响应器类型 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -90,7 +81,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_metaevent(rule=..., permission=..., *, handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-metaevent} @@ -98,7 +88,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个元事件响应器。 - **参数** - - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 - `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限 @@ -116,7 +105,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_message(rule=..., permission=..., *, handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-message} @@ -124,7 +112,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个消息事件响应器。 - **参数** - - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 - `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限 @@ -142,7 +129,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_notice(rule=..., permission=..., *, handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-notice} @@ -150,7 +136,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个通知事件响应器。 - **参数** - - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 - `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限 @@ -168,7 +153,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_request(rule=..., permission=..., *, handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-request} @@ -176,7 +160,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个请求事件响应器。 - **参数** - - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 - `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限 @@ -194,7 +177,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_startswith(msg, rule=..., ignorecase=..., *, permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-startswith} @@ -202,7 +184,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个消息事件响应器,并且当消息的**文本部分**以指定内容开头时响应。 - **参数** - - `msg` (str | tuple[str, ...]): 指定消息开头内容 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -224,7 +205,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_endswith(msg, rule=..., ignorecase=..., *, permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-endswith} @@ -232,7 +212,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个消息事件响应器,并且当消息的**文本部分**以指定内容结尾时响应。 - **参数** - - `msg` (str | tuple[str, ...]): 指定消息结尾内容 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -254,7 +233,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_fullmatch(msg, rule=..., ignorecase=..., *, permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-fullmatch} @@ -262,7 +240,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个消息事件响应器,并且当消息的**文本部分**与指定内容完全一致时响应。 - **参数** - - `msg` (str | tuple[str, ...]): 指定消息全匹配内容 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -284,7 +261,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_keyword(keywords, rule=..., *, permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-keyword} @@ -292,7 +268,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个消息事件响应器,并且当消息纯文本部分包含关键词时响应。 - **参数** - - `keywords` (set[str]): 关键词列表 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -312,7 +287,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_command(cmd, rule=..., aliases=..., force_whitespace=..., *, permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-command} @@ -324,7 +298,6 @@ description: nonebot.plugin.on 模块 命令匹配规则参考: `命令形式匹配 `\_ - **参数** - - `cmd` (str | tuple[str, ...]): 指定命令内容 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -348,7 +321,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_shell_command(cmd, rule=..., aliases=..., parser=..., *, permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-shell-command} @@ -363,7 +335,6 @@ description: nonebot.plugin.on 模块 通过 [ShellCommandArgs](../params.md#ShellCommandArgs) 获取解析后的参数字典。 - **参数** - - `cmd` (str | tuple[str, ...]): 指定命令内容 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -387,7 +358,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_regex(pattern, flags=..., rule=..., *, permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-regex} @@ -399,7 +369,6 @@ description: nonebot.plugin.on 模块 命令匹配规则参考: `正则匹配 `\_ - **参数** - - `pattern` (str): 正则表达式 - `flags` (int | re.RegexFlag): 正则匹配标志 @@ -421,7 +390,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_type(types, rule=..., *, permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-type} @@ -429,7 +397,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个事件响应器,并且当事件为指定类型时响应。 - **参数** - - `types` (type[[Event](../adapters/index.md#Event)] | tuple[type[[Event](../adapters/index.md#Event)], ...]): 事件类型 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -449,13 +416,11 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _class_ `CommandGroup(cmd, prefix_aliases=..., *, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#CommandGroup} - **参数** - - `cmd` (str | tuple[str, ...]) - `prefix_aliases` (bool) @@ -481,7 +446,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个新的命令。新参数将会覆盖命令组默认值 - **参数** - - `cmd` (str | tuple[str, ...]): 指定命令内容 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -505,7 +469,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `shell_command(cmd, *, rule=..., aliases=..., parser=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#CommandGroup-shell-command} @@ -513,7 +476,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个新的 `shell_like` 命令。新参数将会覆盖命令组默认值 - **参数** - - `cmd` (str | tuple[str, ...]): 指定命令内容 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -537,13 +499,11 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _class_ `MatcherGroup(*, type=..., rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup} - **参数** - - `type` (str) - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None) @@ -567,7 +527,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个基础事件响应器,可自定义类型。 - **参数** - - `type` (str): 事件响应器类型 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -587,7 +546,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_metaevent(*, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-metaevent} @@ -595,7 +553,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个元事件响应器。 - **参数** - - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 - `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限 @@ -613,7 +570,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_message(*, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-message} @@ -621,7 +577,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个消息事件响应器。 - **参数** - - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 - `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限 @@ -639,7 +594,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_notice(*, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-notice} @@ -647,7 +601,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个通知事件响应器。 - **参数** - - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 - `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限 @@ -665,7 +618,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_request(*, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-request} @@ -673,7 +625,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个请求事件响应器。 - **参数** - - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 - `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限 @@ -691,7 +642,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_startswith(msg, *, ignorecase=..., rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-startswith} @@ -699,7 +649,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个消息事件响应器,并且当消息的**文本部分**以指定内容开头时响应。 - **参数** - - `msg` (str | tuple[str, ...]): 指定消息开头内容 - `ignorecase` (bool): 是否忽略大小写 @@ -721,7 +670,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_endswith(msg, *, ignorecase=..., rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-endswith} @@ -729,7 +677,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个消息事件响应器,并且当消息的**文本部分**以指定内容结尾时响应。 - **参数** - - `msg` (str | tuple[str, ...]): 指定消息结尾内容 - `ignorecase` (bool): 是否忽略大小写 @@ -751,7 +698,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_fullmatch(msg, *, ignorecase=..., rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-fullmatch} @@ -759,7 +705,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个消息事件响应器,并且当消息的**文本部分**与指定内容完全一致时响应。 - **参数** - - `msg` (str | tuple[str, ...]): 指定消息全匹配内容 - `ignorecase` (bool): 是否忽略大小写 @@ -781,7 +726,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_keyword(keywords, *, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-keyword} @@ -789,7 +733,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个消息事件响应器,并且当消息纯文本部分包含关键词时响应。 - **参数** - - `keywords` (set[str]): 关键词列表 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -809,7 +752,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_command(cmd, aliases=..., force_whitespace=..., *, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-command} @@ -821,7 +763,6 @@ description: nonebot.plugin.on 模块 命令匹配规则参考: `命令形式匹配 `\_ - **参数** - - `cmd` (str | tuple[str, ...]): 指定命令内容 - `aliases` (set[str | tuple[str, ...]] | None): 命令别名 @@ -845,7 +786,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_shell_command(cmd, aliases=..., parser=..., *, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-shell-command} @@ -860,7 +800,6 @@ description: nonebot.plugin.on 模块 通过 [ShellCommandArgs](../params.md#ShellCommandArgs) 获取解析后的参数字典。 - **参数** - - `cmd` (str | tuple[str, ...]): 指定命令内容 - `aliases` (set[str | tuple[str, ...]] | None): 命令别名 @@ -884,7 +823,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_regex(pattern, flags=..., *, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-regex} @@ -896,7 +834,6 @@ description: nonebot.plugin.on 模块 命令匹配规则参考: `正则匹配 `\_ - **参数** - - `pattern` (str): 正则表达式 - `flags` (int | re.RegexFlag): 正则匹配标志 @@ -918,7 +855,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_type(types, *, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-type} @@ -926,7 +862,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个事件响应器,并且当事件为指定类型时响应。 - **参数** - - `types` (type[[Event](../adapters/index.md#Event)] | tuple[type[[Event](../adapters/index.md#Event)]]): 事件类型 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -946,5 +881,4 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] diff --git a/website/versioned_docs/version-2.4.1/api/rule.md b/website/versioned_docs/version-2.4.1/api/rule.md index 3307b13f..23b90248 100644 --- a/website/versioned_docs/version-2.4.1/api/rule.md +++ b/website/versioned_docs/version-2.4.1/api/rule.md @@ -22,7 +22,6 @@ description: nonebot.rule 模块 当事件传递时,在 [Matcher](matcher.md#Matcher) 运行前进行检查。 - **参数** - - `*checkers` ([T_RuleChecker](typing.md#T-RuleChecker) | [Dependent](dependencies/index.md#Dependent)[bool]): RuleChecker - **用法** @@ -44,7 +43,6 @@ description: nonebot.rule 模块 - **说明:** 检查是否符合所有规则 - **参数** - - `bot` ([Bot](adapters/index.md#Bot)): Bot 对象 - `event` ([Event](adapters/index.md#Event)): Event 对象 @@ -56,7 +54,6 @@ description: nonebot.rule 模块 - `dependency_cache` ([T_DependencyCache](typing.md#T-DependencyCache) | None): 依赖缓存 - **返回** - - bool ## _class_ `CMD_RESULT()` {#CMD-RESULT} @@ -78,7 +75,6 @@ description: nonebot.rule 模块 - **说明:** 检查消息纯文本是否以指定字符串开头。 - **参数** - - `msg` (tuple[str, ...]): 指定消息开头字符串元组 - `ignorecase` (bool): 是否忽略大小写 @@ -88,13 +84,11 @@ description: nonebot.rule 模块 - **说明:** 匹配消息纯文本开头。 - **参数** - - `msg` (str | tuple[str, ...]): 指定消息开头字符串元组 - `ignorecase` (bool): 是否忽略大小写 - **返回** - - [Rule](#Rule) ## _class_ `EndswithRule(msg, ignorecase=False)` {#EndswithRule} @@ -102,7 +96,6 @@ description: nonebot.rule 模块 - **说明:** 检查消息纯文本是否以指定字符串结尾。 - **参数** - - `msg` (tuple[str, ...]): 指定消息结尾字符串元组 - `ignorecase` (bool): 是否忽略大小写 @@ -112,13 +105,11 @@ description: nonebot.rule 模块 - **说明:** 匹配消息纯文本结尾。 - **参数** - - `msg` (str | tuple[str, ...]): 指定消息开头字符串元组 - `ignorecase` (bool): 是否忽略大小写 - **返回** - - [Rule](#Rule) ## _class_ `FullmatchRule(msg, ignorecase=False)` {#FullmatchRule} @@ -126,7 +117,6 @@ description: nonebot.rule 模块 - **说明:** 检查消息纯文本是否与指定字符串全匹配。 - **参数** - - `msg` (tuple[str, ...]): 指定消息全匹配字符串元组 - `ignorecase` (bool): 是否忽略大小写 @@ -136,13 +126,11 @@ description: nonebot.rule 模块 - **说明:** 完全匹配消息。 - **参数** - - `msg` (str | tuple[str, ...]): 指定消息全匹配字符串元组 - `ignorecase` (bool): 是否忽略大小写 - **返回** - - [Rule](#Rule) ## _class_ `KeywordsRule(*keywords)` {#KeywordsRule} @@ -150,7 +138,6 @@ description: nonebot.rule 模块 - **说明:** 检查消息纯文本是否包含指定关键字。 - **参数** - - `*keywords` (str): 指定关键字元组 ## _def_ `keyword(*keywords)` {#keyword} @@ -158,11 +145,9 @@ description: nonebot.rule 模块 - **说明:** 匹配消息纯文本关键词。 - **参数** - - `*keywords` (str): 指定关键字元组 - **返回** - - [Rule](#Rule) ## _class_ `CommandRule(cmds, force_whitespace=None)` {#CommandRule} @@ -170,7 +155,6 @@ description: nonebot.rule 模块 - **说明:** 检查消息是否为指定命令。 - **参数** - - `cmds` (list[tuple[str, ...]]): 指定命令元组列表 - `force_whitespace` (str | bool | None): 是否强制命令后必须有指定空白符 @@ -189,13 +173,11 @@ description: nonebot.rule 模块 通过 [CommandArg](params.md#CommandArg) 获取匹配成功的命令参数。 - **参数** - - `*cmds` (str | tuple[str, ...]): 命令文本或命令元组 - `force_whitespace` (str | bool | None): 是否强制命令后必须有指定空白符 - **返回** - - [Rule](#Rule) - **用法** @@ -231,37 +213,28 @@ description: nonebot.rule 模块 - **重载** **1.** `(args=None, namespace=None) -> tuple[Namespace, list[str | MessageSegment]]` - - **参数** - - `args` (Sequence[str | [MessageSegment](adapters/index.md#MessageSegment)] | None) - `namespace` (None) - **返回** - - tuple[Namespace, list[str | [MessageSegment](adapters/index.md#MessageSegment)]] **2.** `(args, namespace) -> tuple[T, list[str | MessageSegment]]` - - **参数** - - `args` (Sequence[str | [MessageSegment](adapters/index.md#MessageSegment)] | None) - `namespace` (T) - **返回** - - tuple[T, list[str | [MessageSegment](adapters/index.md#MessageSegment)]] **3.** `(*, namespace) -> tuple[T, list[str | MessageSegment]]` - - **参数** - - `namespace` (T) - **返回** - - tuple[T, list[str | [MessageSegment](adapters/index.md#MessageSegment)]] ## _class_ `ShellCommandRule(cmds, parser)` {#ShellCommandRule} @@ -269,7 +242,6 @@ description: nonebot.rule 模块 - **说明:** 检查消息是否为指定 shell 命令。 - **参数** - - `cmds` (list[tuple[str, ...]]): 指定命令元组列表 - `parser` (ArgumentParser | None): 可选参数解析器 @@ -298,13 +270,11 @@ description: nonebot.rule 模块 ::: - **参数** - - `*cmds` (str | tuple[str, ...]): 命令文本或命令元组 - `parser` (ArgumentParser | None): [ArgumentParser](#ArgumentParser) 对象 - **返回** - - [Rule](#Rule) - **用法** @@ -330,7 +300,6 @@ description: nonebot.rule 模块 - **说明:** 检查消息字符串是否符合指定正则表达式。 - **参数** - - `regex` (str): 正则表达式 - `flags` (int): 正则表达式标记 @@ -346,13 +315,11 @@ description: nonebot.rule 模块 通过 [RegexDict](params.md#RegexDict) 获取匹配成功的 group 字典。 - **参数** - - `regex` (str): 正则表达式 - `flags` (int | re.RegexFlag): 正则表达式标记 - **返回** - - [Rule](#Rule) :::tip 提示 @@ -380,7 +347,6 @@ description: nonebot.rule 模块 empty - **返回** - - [Rule](#Rule) ## _class_ `IsTypeRule(*types)` {#IsTypeRule} @@ -388,7 +354,6 @@ description: nonebot.rule 模块 - **说明:** 检查事件类型是否为指定类型。 - **参数** - - `*types` (type[[Event](adapters/index.md#Event)]) ## _def_ `is_type(*types)` {#is-type} @@ -396,9 +361,7 @@ description: nonebot.rule 模块 - **说明:** 匹配事件类型。 - **参数** - - `*types` (type[[Event](adapters/index.md#Event)]): 事件类型 - **返回** - - [Rule](#Rule) diff --git a/website/versioned_docs/version-2.4.1/api/typing.md b/website/versioned_docs/version-2.4.1/api/typing.md index 8b1c5005..8a5ea9eb 100644 --- a/website/versioned_docs/version-2.4.1/api/typing.md +++ b/website/versioned_docs/version-2.4.1/api/typing.md @@ -19,31 +19,25 @@ description: nonebot.typing 模块 - **说明:** 标记一个方法为父类 interface 的 implement - **参数** - - `InterfaceClass` (object) - **返回** - - untyped ## _def_ `type_has_args(type_)` {#type-has-args} - **参数** - - `type_` (type[Any]) - **返回** - - bool ## _def_ `origin_is_union(origin)` {#origin-is-union} - **参数** - - `origin` (type[Any] | None) - **返回** - - bool ## _def_ `origin_is_literal(origin)` {#origin-is-literal} @@ -51,11 +45,9 @@ description: nonebot.typing 模块 - **说明:** 判断是否是 Literal 类型 - **参数** - - `origin` (type[Any] | None) - **返回** - - bool ## _def_ `all_literal_values(type_)` {#all-literal-values} @@ -63,11 +55,9 @@ description: nonebot.typing 模块 - **说明:** 获取 Literal 类型包含的所有值 - **参数** - - `type_` (type[Any]) - **返回** - - list[Any] ## _def_ `origin_is_annotated(origin)` {#origin-is-annotated} @@ -75,11 +65,9 @@ description: nonebot.typing 模块 - **说明:** 判断是否是 Annotated 类型 - **参数** - - `origin` (type[Any] | None) - **返回** - - bool ## _def_ `is_none_type(type_)` {#is-none-type} @@ -87,17 +75,14 @@ description: nonebot.typing 模块 - **说明:** 判断是否是 None 类型 - **参数** - - `type_` (type[Any]) - **返回** - - bool ## _def_ `evaluate_forwardref(ref, globalns, localns)` {#evaluate-forwardref} - **参数** - - `ref` (ForwardRef) - `globalns` (dict[str, Any]) @@ -105,7 +90,6 @@ description: nonebot.typing 模块 - `localns` (dict[str, Any]) - **返回** - - Any ## _class_ `StateFlag()` {#StateFlag} @@ -129,7 +113,6 @@ description: nonebot.typing 模块 Bot 连接建立时钩子函数 依赖参数: - - DependParam: 子依赖参数 - BotParam: Bot 对象 - DefaultParam: 带有默认值的参数 @@ -143,7 +126,6 @@ description: nonebot.typing 模块 Bot 连接断开时钩子函数 依赖参数: - - DependParam: 子依赖参数 - BotParam: Bot 对象 - DefaultParam: 带有默认值的参数 @@ -169,7 +151,6 @@ description: nonebot.typing 模块 事件预处理函数 EventPreProcessor 类型 依赖参数: - - DependParam: 子依赖参数 - BotParam: Bot 对象 - EventParam: Event 对象 @@ -185,7 +166,6 @@ description: nonebot.typing 模块 事件后处理函数 EventPostProcessor 类型 依赖参数: - - DependParam: 子依赖参数 - BotParam: Bot 对象 - EventParam: Event 对象 @@ -201,7 +181,6 @@ description: nonebot.typing 模块 事件响应器运行前预处理函数 RunPreProcessor 类型 依赖参数: - - DependParam: 子依赖参数 - BotParam: Bot 对象 - EventParam: Event 对象 @@ -218,7 +197,6 @@ description: nonebot.typing 模块 事件响应器运行后后处理函数 RunPostProcessor 类型 依赖参数: - - DependParam: 子依赖参数 - BotParam: Bot 对象 - EventParam: Event 对象 @@ -236,7 +214,6 @@ description: nonebot.typing 模块 RuleChecker 即判断是否响应事件的处理函数。 依赖参数: - - DependParam: 子依赖参数 - BotParam: Bot 对象 - EventParam: Event 对象 @@ -252,7 +229,6 @@ description: nonebot.typing 模块 PermissionChecker 即判断事件是否满足权限的处理函数。 依赖参数: - - DependParam: 子依赖参数 - BotParam: Bot 对象 - EventParam: Event 对象 @@ -273,7 +249,6 @@ description: nonebot.typing 模块 TypeUpdater 在 Matcher.pause, Matcher.reject 时被运行,用于更新响应的事件类型。 默认会更新为 `message`。 依赖参数: - - DependParam: 子依赖参数 - BotParam: Bot 对象 - EventParam: Event 对象 @@ -290,7 +265,6 @@ description: nonebot.typing 模块 PermissionUpdater 在 Matcher.pause, Matcher.reject 时被运行,用于更新会话对象权限。 默认会更新为当前事件的触发对象。 依赖参数: - - DependParam: 子依赖参数 - BotParam: Bot 对象 - EventParam: Event 对象 diff --git a/website/versioned_docs/version-2.4.1/api/utils.md b/website/versioned_docs/version-2.4.1/api/utils.md index 789478d1..06187453 100644 --- a/website/versioned_docs/version-2.4.1/api/utils.md +++ b/website/versioned_docs/version-2.4.1/api/utils.md @@ -18,11 +18,9 @@ description: nonebot.utils 模块 参考: [loguru color 标签](https://loguru.readthedocs.io/en/stable/api/logger.html#color) - **参数** - - `s` (str): 需要转义的字符串 - **返回** - - str ## _def_ `deep_update(mapping, *updating_mappings)` {#deep-update} @@ -30,13 +28,11 @@ description: nonebot.utils 模块 - **说明:** 深度更新合并字典 - **参数** - - `mapping` (dict[K, Any]) - `*updating_mappings` (dict[K, Any]) - **返回** - - dict[K, Any] ## _def_ `lenient_issubclass(cls, class_or_tuple)` {#lenient-issubclass} @@ -44,13 +40,11 @@ description: nonebot.utils 模块 - **说明:** 检查 cls 是否是 class_or_tuple 中的一个类型子类并忽略类型错误。 - **参数** - - `cls` (Any) - `class_or_tuple` (type[Any] | tuple[type[Any], ...]) - **返回** - - bool ## _def_ `generic_check_issubclass(cls, class_or_tuple)` {#generic-check-issubclass} @@ -60,7 +54,6 @@ description: nonebot.utils 模块 检查 cls 是否是 class_or_tuple 中的一个类型子类。 特别的: - - 如果 cls 是 `typing.Union` 或 `types.UnionType` 类型, 则会检查其中的所有类型是否是 class_or_tuple 中一个类型的子类或 None。 - 如果 cls 是 `typing.Literal` 类型, @@ -70,13 +63,11 @@ description: nonebot.utils 模块 是否是 class_or_tuple 中一个类型的子类或 None。 - **参数** - - `cls` (Any) - `class_or_tuple` (type[Any] | tuple[type[Any], ...]) - **返回** - - bool ## _def_ `type_is_complex(type_)` {#type-is-complex} @@ -84,11 +75,9 @@ description: nonebot.utils 模块 - **说明:** 检查 type\_ 是否是复杂类型 - **参数** - - `type_` (type[Any]) - **返回** - - bool ## _def_ `is_coroutine_callable(call)` {#is-coroutine-callable} @@ -96,11 +85,9 @@ description: nonebot.utils 模块 - **说明:** 检查 call 是否是一个 callable 协程函数 - **参数** - - `call` ((...) -> Any) - **返回** - - bool ## _def_ `is_gen_callable(call)` {#is-gen-callable} @@ -108,11 +95,9 @@ description: nonebot.utils 模块 - **说明:** 检查 call 是否是一个生成器函数 - **参数** - - `call` ((...) -> Any) - **返回** - - bool ## _def_ `is_async_gen_callable(call)` {#is-async-gen-callable} @@ -120,11 +105,9 @@ description: nonebot.utils 模块 - **说明:** 检查 call 是否是一个异步生成器函数 - **参数** - - `call` ((...) -> Any) - **返回** - - bool ## _def_ `run_sync(call)` {#run-sync} @@ -132,11 +115,9 @@ description: nonebot.utils 模块 - **说明:** 一个用于包装 sync function 为 async function 的装饰器 - **参数** - - `call` ((P) -> R): 被装饰的同步函数 - **返回** - - (P) -> Coroutine[None, None, R] ## _def_ `run_sync_ctx_manager(cm)` {#run-sync-ctx-manager} @@ -144,11 +125,9 @@ description: nonebot.utils 模块 - **说明:** 一个用于包装 sync context manager 为 async context manager 的执行函数 - **参数** - - `cm` (AbstractContextManager[T]) - **返回** - - AsyncGenerator[T, None] ## _async def_ `run_coro_with_catch(coro, exc, return_on_err=None)` {#run-coro-with-catch} @@ -158,9 +137,7 @@ description: nonebot.utils 模块 - **重载** **1.** `(coro, exc, return_on_err=None) -> T | None` - - **参数** - - `coro` (Coroutine[Any, Any, T]) - `exc` (tuple[type[Exception], ...]) @@ -168,13 +145,10 @@ description: nonebot.utils 模块 - `return_on_err` (None) - **返回** - - T | None **2.** `(coro, exc, return_on_err) -> T | R` - - **参数** - - `coro` (Coroutine[Any, Any, T]) - `exc` (tuple[type[Exception], ...]) @@ -182,11 +156,9 @@ description: nonebot.utils 模块 - `return_on_err` (R) - **返回** - - T | R - **参数** - - `coro`: 要运行的协程 - `exc`: 要捕获的异常 @@ -202,21 +174,17 @@ description: nonebot.utils 模块 - **说明:** 运行协程并在取消时屏蔽取消异常。 - **参数** - - `coro` (Coroutine[Any, Any, T]): 要运行的协程 - **返回** - - T: 协程的返回值 ## _def_ `flatten_exception_group(exc_group)` {#flatten-exception-group} - **参数** - - `exc_group` (BaseExceptionGroup[E]) - **返回** - - Generator[E, None, None] ## _def_ `get_name(obj)` {#get-name} @@ -224,11 +192,9 @@ description: nonebot.utils 模块 - **说明:** 获取对象的名称 - **参数** - - `obj` (Any) - **返回** - - str ## _def_ `path_to_module_name(path)` {#path-to-module-name} @@ -236,11 +202,9 @@ description: nonebot.utils 模块 - **说明:** 转换路径为模块名 - **参数** - - `path` (Path) - **返回** - - str ## _def_ `resolve_dot_notation(obj_str, default_attr, default_prefix=None)` {#resolve-dot-notation} @@ -248,7 +212,6 @@ description: nonebot.utils 模块 - **说明:** 解析并导入点分表示法的对象 - **参数** - - `obj_str` (str) - `default_attr` (str) @@ -256,7 +219,6 @@ description: nonebot.utils 模块 - `default_prefix` (str | None) - **返回** - - Any ## _class_ `classproperty(func)` {#classproperty} @@ -264,7 +226,6 @@ description: nonebot.utils 模块 - **说明:** 类属性装饰器 - **参数** - - `func` ((Any) -> T) ## _class_ `DataclassEncoder()` {#DataclassEncoder} @@ -278,11 +239,9 @@ description: nonebot.utils 模块 ### _method_ `default(o)` {#DataclassEncoder-default} - **参数** - - `o` - **返回** - - untyped ## _def_ `logger_wrapper(logger_name)` {#logger-wrapper} @@ -290,15 +249,12 @@ description: nonebot.utils 模块 - **说明:** 用于打印 adapter 的日志。 - **参数** - - `logger_name` (str): adapter 的名称 - **返回** - - untyped: 日志记录函数 日志记录函数的参数: - - level: 日志等级 - message: 日志信息 - exception: 异常信息 diff --git a/website/versioned_docs/version-2.4.1/best-practice/alconna/command.md b/website/versioned_docs/version-2.4.1/best-practice/alconna/command.md index e5df7cbd..65a97131 100644 --- a/website/versioned_docs/version-2.4.1/best-practice/alconna/command.md +++ b/website/versioned_docs/version-2.4.1/best-practice/alconna/command.md @@ -278,7 +278,6 @@ opt2 = Option("--foo", default=OptionResult(value=False, args={"bar": 1})) `Arparma` 有如下属性: - 调试类 - - matched: 是否匹配成功 - error_data: 解析失败时剩余的数据 - error_info: 解析失败时的异常内容 diff --git a/website/versioned_docs/version-2.4.1/best-practice/testing/behavior.mdx b/website/versioned_docs/version-2.4.1/best-practice/testing/behavior.mdx index 3203d8a8..37d55c13 100644 --- a/website/versioned_docs/version-2.4.1/best-practice/testing/behavior.mdx +++ b/website/versioned_docs/version-2.4.1/best-practice/testing/behavior.mdx @@ -155,7 +155,6 @@ async def test_example(app: App): 1. `should_call_send` 定义事件响应器预期发送的消息,即通过[事件响应器操作 send](../../appendices/session-control.mdx#send)进行的操作。`should_call_send` 有四个参数: - - `event`:回复的目标事件。 - `message`:预期的消息对象,可以是 `str`、`Message` 或 `MessageSegment`。 - `result`:send 的返回值,将会返回给插件。 @@ -164,7 +163,6 @@ async def test_example(app: App): 2. `should_call_api` 定义事件响应器预期调用的平台 API 接口,即通过[调用平台 API](../../appendices/api-calling.mdx#调用平台-api)进行的操作。`should_call_api` 有四个参数: - - `api`:API 名称。 - `data`:预期的请求数据。 - `result`:call_api 的返回值,将会返回给插件。 diff --git a/website/versioned_docs/version-2.4.2/api/adapters/index.md b/website/versioned_docs/version-2.4.2/api/adapters/index.md index 5352562b..4de79286 100644 --- a/website/versioned_docs/version-2.4.2/api/adapters/index.md +++ b/website/versioned_docs/version-2.4.2/api/adapters/index.md @@ -20,7 +20,6 @@ description: nonebot.adapters 模块 通常,在 Adapter 中编写协议通信相关代码,如: 建立通信连接、处理接收与发送 data 等。 - **参数** - - `driver` ([Driver](../drivers/index.md#Driver)): [Driver](../drivers/index.md#Driver) 实例 - `**kwargs` (Any): 其他由 [Driver.register_adapter](../drivers/index.md#Driver-register-adapter) 传入的额外参数 @@ -46,7 +45,6 @@ description: nonebot.adapters 模块 empty - **返回** - - str ### _property_ `config` {#Adapter-config} @@ -64,11 +62,9 @@ description: nonebot.adapters 模块 当有新的 [Bot](#Bot) 实例连接建立成功时调用。 - **参数** - - `bot` ([Bot](#Bot)): [Bot](#Bot) 实例 - **返回** - - None ### _method_ `bot_disconnect(bot)` {#Adapter-bot-disconnect} @@ -80,11 +76,9 @@ description: nonebot.adapters 模块 当有 [Bot](#Bot) 实例连接断开时调用。 - **参数** - - `bot` ([Bot](#Bot)): [Bot](#Bot) 实例 - **返回** - - None ### _method_ `setup_http_server(setup)` {#Adapter-setup-http-server} @@ -92,11 +86,9 @@ description: nonebot.adapters 模块 - **说明:** 设置一个 HTTP 服务器路由配置 - **参数** - - `setup` ([HTTPServerSetup](../drivers/index.md#HTTPServerSetup)) - **返回** - - untyped ### _method_ `setup_websocket_server(setup)` {#Adapter-setup-websocket-server} @@ -104,11 +96,9 @@ description: nonebot.adapters 模块 - **说明:** 设置一个 WebSocket 服务器路由配置 - **参数** - - `setup` ([WebSocketServerSetup](../drivers/index.md#WebSocketServerSetup)) - **返回** - - untyped ### _async method_ `request(setup)` {#Adapter-request} @@ -116,11 +106,9 @@ description: nonebot.adapters 模块 - **说明:** 进行一个 HTTP 客户端请求 - **参数** - - `setup` ([Request](../drivers/index.md#Request)) - **返回** - - [Response](../drivers/index.md#Response) ### _method_ `websocket(setup)` {#Adapter-websocket} @@ -128,21 +116,17 @@ description: nonebot.adapters 模块 - **说明:** 建立一个 WebSocket 客户端连接请求 - **参数** - - `setup` ([Request](../drivers/index.md#Request)) - **返回** - - AsyncGenerator[[WebSocket](../drivers/index.md#WebSocket), None] ### _method_ `on_ready(func)` {#Adapter-on-ready} - **参数** - - `func` (LIFESPAN_FUNC) - **返回** - - LIFESPAN_FUNC ## _abstract class_ `Bot(adapter, self_id)` {#Bot} @@ -154,7 +138,6 @@ description: nonebot.adapters 模块 用于处理上报消息,并提供 API 调用接口。 - **参数** - - `adapter` ([Adapter](#Adapter)): 协议适配器实例 - `self_id` (str): 机器人 ID @@ -188,13 +171,11 @@ description: nonebot.adapters 模块 - **说明:** 调用机器人 API 接口,可以通过该函数或直接通过 bot 属性进行调用 - **参数** - - `api` (str): API 名称 - `**data` (Any): API 数据 - **返回** - - Any - **用法** @@ -209,7 +190,6 @@ description: nonebot.adapters 模块 - **说明:** 调用机器人基础发送消息接口 - **参数** - - `event` ([Event](#Event)): 上报事件 - `message` (str | [Message](#Message) | [MessageSegment](#MessageSegment)): 要发送的消息 @@ -217,7 +197,6 @@ description: nonebot.adapters 模块 - `**kwargs` (Any): 任意额外参数 - **返回** - - Any ### _classmethod_ `on_calling_api(func)` {#Bot-on-calling-api} @@ -227,17 +206,14 @@ description: nonebot.adapters 模块 调用 api 预处理。 钩子函数参数: - - bot: 当前 bot 对象 - api: 调用的 api 名称 - data: api 调用的参数字典 - **参数** - - `func` ([T_CallingAPIHook](../typing.md#T-CallingAPIHook)) - **返回** - - [T_CallingAPIHook](../typing.md#T-CallingAPIHook) ### _classmethod_ `on_called_api(func)` {#Bot-on-called-api} @@ -247,7 +223,6 @@ description: nonebot.adapters 模块 调用 api 后处理。 钩子函数参数: - - bot: 当前 bot 对象 - exception: 调用 api 时发生的错误 - api: 调用的 api 名称 @@ -255,11 +230,9 @@ description: nonebot.adapters 模块 - result: api 调用的返回 - **参数** - - `func` ([T_CalledAPIHook](../typing.md#T-CalledAPIHook)) - **返回** - - [T_CalledAPIHook](../typing.md#T-CalledAPIHook) ## _abstract class_ `Event()` {#Event} @@ -279,7 +252,6 @@ description: nonebot.adapters 模块 empty - **返回** - - str ### _abstract method_ `get_event_name()` {#Event-get-event-name} @@ -291,7 +263,6 @@ description: nonebot.adapters 模块 empty - **返回** - - str ### _abstract method_ `get_event_description()` {#Event-get-event-description} @@ -303,7 +274,6 @@ description: nonebot.adapters 模块 empty - **返回** - - str ### _method_ `get_log_string()` {#Event-get-log-string} @@ -320,11 +290,9 @@ description: nonebot.adapters 模块 empty - **返回** - - str - **异常** - - NoLogException: 希望 NoneBot 隐藏该事件日志 ### _abstract method_ `get_user_id()` {#Event-get-user-id} @@ -336,7 +304,6 @@ description: nonebot.adapters 模块 empty - **返回** - - str ### _abstract method_ `get_session_id()` {#Event-get-session-id} @@ -348,7 +315,6 @@ description: nonebot.adapters 模块 empty - **返回** - - str ### _abstract method_ `get_message()` {#Event-get-message} @@ -360,7 +326,6 @@ description: nonebot.adapters 模块 empty - **返回** - - [Message](#Message) ### _method_ `get_plaintext()` {#Event-get-plaintext} @@ -376,7 +341,6 @@ description: nonebot.adapters 模块 empty - **返回** - - str ### _abstract method_ `is_tome()` {#Event-is-tome} @@ -388,7 +352,6 @@ description: nonebot.adapters 模块 empty - **返回** - - bool ## _abstract class_ `Message()` {#Message} @@ -396,7 +359,6 @@ description: nonebot.adapters 模块 - **说明:** 消息序列 - **参数** - - `message`: 消息内容 ### _classmethod_ `template(format_string)` {#Message-template} @@ -410,11 +372,9 @@ description: nonebot.adapters 模块 可以通过该消息类型的 `MessageSegment` 工厂方法创建消息。 - **参数** - - `format_string` (str | TM): 格式化模板 - **返回** - - [MessageTemplate](#MessageTemplate)[Self]: 消息格式化器 ### _abstract classmethod_ `get_segment_class()` {#Message-get-segment-class} @@ -426,7 +386,6 @@ description: nonebot.adapters 模块 empty - **返回** - - type[TMS] ### _abstract staticmethod_ `_construct(msg)` {#Message--construct} @@ -434,11 +393,9 @@ description: nonebot.adapters 模块 - **说明:** 构造消息数组 - **参数** - - `msg` (str) - **返回** - - Iterable[TMS] ### _method_ `__getitem__(args)` {#Message---getitem--} @@ -446,53 +403,38 @@ description: nonebot.adapters 模块 - **重载** **1.** `(args) -> Self` - - **参数** - - `args` (str): 消息段类型 - **返回** - - Self: 所有类型为 `args` 的消息段 **2.** `(args) -> TMS` - - **参数** - - `args` (tuple[str, int]): 消息段类型和索引 - **返回** - - TMS: 类型为 `args[0]` 的消息段第 `args[1]` 个 **3.** `(args) -> Self` - - **参数** - - `args` (tuple[str, slice]): 消息段类型和切片 - **返回** - - Self: 类型为 `args[0]` 的消息段切片 `args[1]` **4.** `(args) -> TMS` - - **参数** - - `args` (int): 索引 - **返回** - - TMS: 第 `args` 个消息段 **5.** `(args) -> Self` - - **参数** - - `args` (slice): 切片 - **返回** - - Self: 消息切片 `args` ### _method_ `__contains__(value)` {#Message---contains--} @@ -500,11 +442,9 @@ description: nonebot.adapters 模块 - **说明:** 检查消息段是否存在 - **参数** - - `value` (TMS | str): 消息段或消息段类型 - **返回** - - bool: 消息内是否存在给定消息段或给定类型的消息段 ### _method_ `has(value)` {#Message-has} @@ -512,11 +452,9 @@ description: nonebot.adapters 模块 - **说明:** 与 [`__contains__`](#Message---contains--) 相同 - **参数** - - `value` (TMS | str) - **返回** - - bool ### _method_ `index(value, *args)` {#Message-index} @@ -524,7 +462,6 @@ description: nonebot.adapters 模块 - **说明:** 索引消息段 - **参数** - - `value` (TMS | str): 消息段或者消息段类型 - `*args` (SupportsIndex) @@ -532,11 +469,9 @@ description: nonebot.adapters 模块 - `arg`: start 与 end - **返回** - - int: 索引 index - **异常** - - ValueError: 消息段不存在 ### _method_ `get(type_, count=None)` {#Message-get} @@ -544,13 +479,11 @@ description: nonebot.adapters 模块 - **说明:** 获取指定类型的消息段 - **参数** - - `type_` (str): 消息段类型 - `count` (int | None): 获取个数 - **返回** - - Self: 构建的新消息 ### _method_ `count(value)` {#Message-count} @@ -558,11 +491,9 @@ description: nonebot.adapters 模块 - **说明:** 计算指定消息段的个数 - **参数** - - `value` (TMS | str): 消息段或消息段类型 - **返回** - - int: 个数 ### _method_ `only(value)` {#Message-only} @@ -570,11 +501,9 @@ description: nonebot.adapters 模块 - **说明:** 检查消息中是否仅包含指定消息段 - **参数** - - `value` (TMS | str): 指定消息段或消息段类型 - **返回** - - bool: 是否仅包含指定消息段 ### _method_ `append(obj)` {#Message-append} @@ -582,11 +511,9 @@ description: nonebot.adapters 模块 - **说明:** 添加一个消息段到消息数组末尾。 - **参数** - - `obj` (str | TMS): 要添加的消息段 - **返回** - - Self ### _method_ `extend(obj)` {#Message-extend} @@ -594,11 +521,9 @@ description: nonebot.adapters 模块 - **说明:** 拼接一个消息数组或多个消息段到消息数组末尾。 - **参数** - - `obj` (Self | Iterable[TMS]): 要添加的消息数组 - **返回** - - Self ### _method_ `join(iterable)` {#Message-join} @@ -606,11 +531,9 @@ description: nonebot.adapters 模块 - **说明:** 将多个消息连接并将自身作为分割 - **参数** - - `iterable` (Iterable[TMS | Self]): 要连接的消息 - **返回** - - Self: 连接后的消息 ### _method_ `copy()` {#Message-copy} @@ -622,7 +545,6 @@ description: nonebot.adapters 模块 empty - **返回** - - Self ### _method_ `include(*types)` {#Message-include} @@ -630,11 +552,9 @@ description: nonebot.adapters 模块 - **说明:** 过滤消息 - **参数** - - `*types` (str): 包含的消息段类型 - **返回** - - Self: 新构造的消息 ### _method_ `exclude(*types)` {#Message-exclude} @@ -642,11 +562,9 @@ description: nonebot.adapters 模块 - **说明:** 过滤消息 - **参数** - - `*types` (str): 不包含的消息段类型 - **返回** - - Self: 新构造的消息 ### _method_ `extract_plain_text()` {#Message-extract-plain-text} @@ -658,7 +576,6 @@ description: nonebot.adapters 模块 empty - **返回** - - str ## _abstract class_ `MessageSegment()` {#MessageSegment} @@ -690,7 +607,6 @@ description: nonebot.adapters 模块 empty - **返回** - - type[TM] ### _abstract method_ `__str__()` {#MessageSegment---str--} @@ -702,29 +618,24 @@ description: nonebot.adapters 模块 empty - **返回** - - str ### _method_ `__add__(other)` {#MessageSegment---add--} - **参数** - - `other` (str | TMS | Iterable[TMS]) - **返回** - - TM ### _method_ `get(key, default=None)` {#MessageSegment-get} - **参数** - - `key` (str) - `default` (Any) - **返回** - - untyped ### _method_ `keys()` {#MessageSegment-keys} @@ -734,7 +645,6 @@ description: nonebot.adapters 模块 empty - **返回** - - untyped ### _method_ `values()` {#MessageSegment-values} @@ -744,7 +654,6 @@ description: nonebot.adapters 模块 empty - **返回** - - untyped ### _method_ `items()` {#MessageSegment-items} @@ -754,17 +663,14 @@ description: nonebot.adapters 模块 empty - **返回** - - untyped ### _method_ `join(iterable)` {#MessageSegment-join} - **参数** - - `iterable` (Iterable[TMS | TM]) - **返回** - - TM ### _method_ `copy()` {#MessageSegment-copy} @@ -774,7 +680,6 @@ description: nonebot.adapters 模块 empty - **返回** - - Self ### _abstract method_ `is_text()` {#MessageSegment-is-text} @@ -786,7 +691,6 @@ description: nonebot.adapters 模块 empty - **返回** - - bool ## _class_ `MessageTemplate(template, factory=str, private_getattr=False)` {#MessageTemplate} @@ -794,7 +698,6 @@ description: nonebot.adapters 模块 - **说明:** 消息模板格式化实现类。 - **参数** - - `template` (str | TM): 模板 - `factory` (type[str] | type[TM]): 消息类型工厂,默认为 `str` @@ -804,13 +707,11 @@ description: nonebot.adapters 模块 ### _method_ `add_format_spec(spec, name=None)` {#MessageTemplate-add-format-spec} - **参数** - - `spec` (FormatSpecFunc_T) - `name` (str | None) - **返回** - - FormatSpecFunc_T ### _method_ `format(*args, **kwargs)` {#MessageTemplate-format} @@ -818,13 +719,11 @@ description: nonebot.adapters 模块 - **说明:** 根据传入参数和模板生成消息对象 - **参数** - - `*args` - `**kwargs` - **返回** - - TF ### _method_ `format_map(mapping)` {#MessageTemplate-format-map} @@ -832,17 +731,14 @@ description: nonebot.adapters 模块 - **说明:** 根据传入字典和模板生成消息对象, 在传入字段名不是有效标识符时有用 - **参数** - - `mapping` (Mapping[str, Any]) - **返回** - - TF ### _method_ `vformat(format_string, args, kwargs)` {#MessageTemplate-vformat} - **参数** - - `format_string` (str) - `args` (Sequence[Any]) @@ -850,13 +746,11 @@ description: nonebot.adapters 模块 - `kwargs` (Mapping[str, Any]) - **返回** - - TF ### _method_ `get_field(field_name, args, kwargs)` {#MessageTemplate-get-field} - **参数** - - `field_name` (str) - `args` (Sequence[Any]) @@ -864,17 +758,14 @@ description: nonebot.adapters 模块 - `kwargs` (Mapping[str, Any]) - **返回** - - tuple[Any, int | str] ### _method_ `format_field(value, format_spec)` {#MessageTemplate-format-field} - **参数** - - `value` (Any) - `format_spec` (str) - **返回** - - Any diff --git a/website/versioned_docs/version-2.4.2/api/compat.md b/website/versioned_docs/version-2.4.2/api/compat.md index e4f9da20..b497b6f4 100644 --- a/website/versioned_docs/version-2.4.2/api/compat.md +++ b/website/versioned_docs/version-2.4.2/api/compat.md @@ -36,7 +36,6 @@ description: nonebot.compat 模块 - **说明:** FieldInfo class with extra property for compatibility with pydantic v1 - **参数** - - `default` (Any) - `**kwargs` (Any) @@ -82,7 +81,6 @@ description: nonebot.compat 模块 - **说明:** Construct a ModelField from given infos. - **参数** - - `name` (str) - `annotation` (Any) @@ -90,7 +88,6 @@ description: nonebot.compat 模块 - `field_info` (FieldInfo | None) - **返回** - - Self ### _method_ `get_default()` {#ModelField-get-default} @@ -102,7 +99,6 @@ description: nonebot.compat 模块 empty - **返回** - - Any ### _method_ `validate_value(value)` {#ModelField-validate-value} @@ -110,11 +106,9 @@ description: nonebot.compat 模块 - **说明:** Validate the value pass to the field. - **参数** - - `value` (Any) - **返回** - - Any ## _def_ `extract_field_info(field_info)` {#extract-field-info} @@ -122,11 +116,9 @@ description: nonebot.compat 模块 - **说明:** Get FieldInfo init kwargs from a FieldInfo instance. - **参数** - - `field_info` (BaseFieldInfo) - **返回** - - dict[str, Any] ## _def_ `model_fields(model)` {#model-fields} @@ -134,11 +126,9 @@ description: nonebot.compat 模块 - **说明:** Get field list of a model. - **参数** - - `model` (type[BaseModel]) - **返回** - - list[ModelField] ## _def_ `model_config(model)` {#model-config} @@ -146,17 +136,14 @@ description: nonebot.compat 模块 - **说明:** Get config of a model. - **参数** - - `model` (type[BaseModel]) - **返回** - - Any ## _def_ `model_dump(model, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False)` {#model-dump} - **参数** - - `model` (BaseModel) - `include` (set[str] | None) @@ -172,7 +159,6 @@ description: nonebot.compat 模块 - `exclude_none` (bool) - **返回** - - dict[str, Any] ## _def_ `type_validate_python(type_, data)` {#type-validate-python} @@ -180,13 +166,11 @@ description: nonebot.compat 模块 - **说明:** Validate data with given type. - **参数** - - `type_` (type[T]) - `data` (Any) - **返回** - - T ## _def_ `type_validate_json(type_, data)` {#type-validate-json} @@ -194,13 +178,11 @@ description: nonebot.compat 模块 - **说明:** Validate JSON with given type. - **参数** - - `type_` (type[T]) - `data` (str | bytes) - **返回** - - T ## _def_ `custom_validation(class_)` {#custom-validation} @@ -208,9 +190,7 @@ description: nonebot.compat 模块 - **说明:** Use pydantic v1 like validator generator in pydantic v2 - **参数** - - `class_` (type[CVC]) - **返回** - - type[CVC] diff --git a/website/versioned_docs/version-2.4.2/api/config.md b/website/versioned_docs/version-2.4.2/api/config.md index 847404fd..6bf23ee8 100644 --- a/website/versioned_docs/version-2.4.2/api/config.md +++ b/website/versioned_docs/version-2.4.2/api/config.md @@ -24,7 +24,6 @@ NoneBot 使用 [`pydantic`](https://pydantic-docs.helpmanual.io/) 以及 将会从 **环境变量** > **dotenv 配置文件** 的优先级读取环境信息。 - **参数** - - `_env_file` (DOTENV_TYPE | None) - `_env_file_encoding` (str | None) @@ -55,7 +54,6 @@ NoneBot 使用 [`pydantic`](https://pydantic-docs.helpmanual.io/) 以及 配置方法参考: [配置](https://nonebot.dev/docs/appendices/config) - **参数** - - `_env_file` (DOTENV_TYPE | None) - `_env_file_encoding` (str | None) diff --git a/website/versioned_docs/version-2.4.2/api/dependencies/index.md b/website/versioned_docs/version-2.4.2/api/dependencies/index.md index c11b6e8c..74732936 100644 --- a/website/versioned_docs/version-2.4.2/api/dependencies/index.md +++ b/website/versioned_docs/version-2.4.2/api/dependencies/index.md @@ -18,7 +18,6 @@ description: nonebot.dependencies 模块 继承自 `pydantic.fields.FieldInfo`,用于描述参数信息(不包括参数名)。 - **参数** - - `*args` - `validate` (bool) @@ -30,7 +29,6 @@ description: nonebot.dependencies 模块 - **说明:** 依赖注入容器 - **参数** - - `call`: 依赖注入的可调用对象,可以是任何 Callable 对象 - `pre_checkers`: 依赖注入解析前的参数检查 @@ -44,31 +42,26 @@ description: nonebot.dependencies 模块 ### _staticmethod_ `parse_params(call, allow_types)` {#Dependent-parse-params} - **参数** - - `call` (\_DependentCallable[R]) - `allow_types` (tuple[type[Param], ...]) - **返回** - - tuple[[ModelField](../compat.md#ModelField), ...] ### _staticmethod_ `parse_parameterless(parameterless, allow_types)` {#Dependent-parse-parameterless} - **参数** - - `parameterless` (tuple[Any, ...]) - `allow_types` (tuple[type[Param], ...]) - **返回** - - tuple[Param, ...] ### _classmethod_ `parse(*, call, parameterless=None, allow_types)` {#Dependent-parse} - **参数** - - `call` (\_DependentCallable[R]) - `parameterless` (Iterable[Any] | None) @@ -76,25 +69,20 @@ description: nonebot.dependencies 模块 - `allow_types` (Iterable[type[Param]]) - **返回** - - Dependent[R] ### _async method_ `check(**params)` {#Dependent-check} - **参数** - - `**params` (Any) - **返回** - - None ### _async method_ `solve(**params)` {#Dependent-solve} - **参数** - - `**params` (Any) - **返回** - - dict[str, Any] diff --git a/website/versioned_docs/version-2.4.2/api/dependencies/utils.md b/website/versioned_docs/version-2.4.2/api/dependencies/utils.md index 10c4fd74..2b19f9c5 100644 --- a/website/versioned_docs/version-2.4.2/api/dependencies/utils.md +++ b/website/versioned_docs/version-2.4.2/api/dependencies/utils.md @@ -12,11 +12,9 @@ description: nonebot.dependencies.utils 模块 - **说明:** 获取可调用对象签名 - **参数** - - `call` ((...) -> Any) - **返回** - - inspect.Signature ## _def_ `get_typed_annotation(param, globalns)` {#get-typed-annotation} @@ -24,13 +22,11 @@ description: nonebot.dependencies.utils 模块 - **说明:** 获取参数的类型注解 - **参数** - - `param` (inspect.Parameter) - `globalns` (dict[str, Any]) - **返回** - - Any ## _def_ `check_field_type(field, value)` {#check-field-type} @@ -38,11 +34,9 @@ description: nonebot.dependencies.utils 模块 - **说明:** 检查字段类型是否匹配 - **参数** - - `field` ([ModelField](../compat.md#ModelField)) - `value` (Any) - **返回** - - Any diff --git a/website/versioned_docs/version-2.4.2/api/drivers/aiohttp.md b/website/versioned_docs/version-2.4.2/api/drivers/aiohttp.md index 57147258..a45a245c 100644 --- a/website/versioned_docs/version-2.4.2/api/drivers/aiohttp.md +++ b/website/versioned_docs/version-2.4.2/api/drivers/aiohttp.md @@ -22,7 +22,6 @@ pip install nonebot2[aiohttp] ## _class_ `Session(params=None, headers=None, cookies=None, version=HTTPVersion.H11, timeout=None, proxy=None)` {#Session} - **参数** - - `params` (QueryTypes) - `headers` (HeaderTypes) @@ -38,11 +37,9 @@ pip install nonebot2[aiohttp] ### _async method_ `request(setup)` {#Session-request} - **参数** - - `setup` ([Request](index.md#Request)) - **返回** - - [Response](index.md#Response) ### _async method_ `setup()` {#Session-setup} @@ -52,7 +49,6 @@ pip install nonebot2[aiohttp] empty - **返回** - - None ### _async method_ `close()` {#Session-close} @@ -62,7 +58,6 @@ pip install nonebot2[aiohttp] empty - **返回** - - None ## _class_ `Mixin()` {#Mixin} @@ -76,27 +71,22 @@ pip install nonebot2[aiohttp] ### _async method_ `request(setup)` {#Mixin-request} - **参数** - - `setup` ([Request](index.md#Request)) - **返回** - - [Response](index.md#Response) ### _method_ `websocket(setup)` {#Mixin-websocket} - **参数** - - `setup` ([Request](index.md#Request)) - **返回** - - AsyncGenerator[[WebSocket](index.md#WebSocket), None] ### _method_ `get_session(params=None, headers=None, cookies=None, version=HTTPVersion.H11, timeout=None, proxy=None)` {#Mixin-get-session} - **参数** - - `params` (QueryTypes) - `headers` (HeaderTypes) @@ -110,7 +100,6 @@ pip install nonebot2[aiohttp] - `proxy` (str | None) - **返回** - - Session ## _class_ `WebSocket(*, request, session, websocket)` {#WebSocket} @@ -118,7 +107,6 @@ pip install nonebot2[aiohttp] - **说明:** AIOHTTP Websocket Wrapper - **参数** - - `request` ([Request](index.md#Request)) - `session` (aiohttp.ClientSession) @@ -132,19 +120,16 @@ pip install nonebot2[aiohttp] empty - **返回** - - untyped ### _async method_ `close(code=1000, reason="")` {#WebSocket-close} - **参数** - - `code` (int) - `reason` (str) - **返回** - - untyped ### _async method_ `receive()` {#WebSocket-receive} @@ -154,7 +139,6 @@ pip install nonebot2[aiohttp] empty - **返回** - - str ### _async method_ `receive_text()` {#WebSocket-receive-text} @@ -164,7 +148,6 @@ pip install nonebot2[aiohttp] empty - **返回** - - str ### _async method_ `receive_bytes()` {#WebSocket-receive-bytes} @@ -174,33 +157,27 @@ pip install nonebot2[aiohttp] empty - **返回** - - bytes ### _async method_ `send_text(data)` {#WebSocket-send-text} - **参数** - - `data` (str) - **返回** - - None ### _async method_ `send_bytes(data)` {#WebSocket-send-bytes} - **参数** - - `data` (bytes) - **返回** - - None ## _class_ `Driver(env, config)` {#Driver} - **参数** - - `env` ([Env](../config.md#Env)) - `config` ([Config](../config.md#Config)) diff --git a/website/versioned_docs/version-2.4.2/api/drivers/fastapi.md b/website/versioned_docs/version-2.4.2/api/drivers/fastapi.md index bc7da389..0e80894e 100644 --- a/website/versioned_docs/version-2.4.2/api/drivers/fastapi.md +++ b/website/versioned_docs/version-2.4.2/api/drivers/fastapi.md @@ -92,7 +92,6 @@ pip install nonebot2[fastapi] - **说明:** FastAPI 驱动框架。 - **参数** - - `env` ([Env](../config.md#Env)) - `config` (NoneBotConfig) @@ -124,21 +123,17 @@ pip install nonebot2[fastapi] ### _method_ `setup_http_server(setup)` {#Driver-setup-http-server} - **参数** - - `setup` ([HTTPServerSetup](index.md#HTTPServerSetup)) - **返回** - - untyped ### _method_ `setup_websocket_server(setup)` {#Driver-setup-websocket-server} - **参数** - - `setup` ([WebSocketServerSetup](index.md#WebSocketServerSetup)) - **返回** - - None ### _method_ `run(host=None, port=None, *args, app=None, **kwargs)` {#Driver-run} @@ -146,7 +141,6 @@ pip install nonebot2[fastapi] - **说明:** 使用 `uvicorn` 启动 FastAPI - **参数** - - `host` (str | None) - `port` (int | None) @@ -158,7 +152,6 @@ pip install nonebot2[fastapi] - `**kwargs` - **返回** - - untyped ## _class_ `FastAPIWebSocket(*, request, websocket)` {#FastAPIWebSocket} @@ -166,7 +159,6 @@ pip install nonebot2[fastapi] - **说明:** FastAPI WebSocket Wrapper - **参数** - - `request` (BaseRequest) - `websocket` ([WebSocket](index.md#WebSocket)) @@ -178,19 +170,16 @@ pip install nonebot2[fastapi] empty - **返回** - - None ### _async method_ `close(code=status.WS_1000_NORMAL_CLOSURE, reason="")` {#FastAPIWebSocket-close} - **参数** - - `code` (int) - `reason` (str) - **返回** - - None ### _async method_ `receive()` {#FastAPIWebSocket-receive} @@ -200,7 +189,6 @@ pip install nonebot2[fastapi] empty - **返回** - - str | bytes ### _async method_ `receive_text()` {#FastAPIWebSocket-receive-text} @@ -210,7 +198,6 @@ pip install nonebot2[fastapi] empty - **返回** - - str ### _async method_ `receive_bytes()` {#FastAPIWebSocket-receive-bytes} @@ -220,25 +207,20 @@ pip install nonebot2[fastapi] empty - **返回** - - bytes ### _async method_ `send_text(data)` {#FastAPIWebSocket-send-text} - **参数** - - `data` (str) - **返回** - - None ### _async method_ `send_bytes(data)` {#FastAPIWebSocket-send-bytes} - **参数** - - `data` (bytes) - **返回** - - None diff --git a/website/versioned_docs/version-2.4.2/api/drivers/httpx.md b/website/versioned_docs/version-2.4.2/api/drivers/httpx.md index e40efc39..8b5a6b53 100644 --- a/website/versioned_docs/version-2.4.2/api/drivers/httpx.md +++ b/website/versioned_docs/version-2.4.2/api/drivers/httpx.md @@ -22,7 +22,6 @@ pip install nonebot2[httpx] ## _class_ `Session(params=None, headers=None, cookies=None, version=HTTPVersion.H11, timeout=None, proxy=None)` {#Session} - **参数** - - `params` (QueryTypes) - `headers` (HeaderTypes) @@ -38,11 +37,9 @@ pip install nonebot2[httpx] ### _async method_ `request(setup)` {#Session-request} - **参数** - - `setup` ([Request](index.md#Request)) - **返回** - - [Response](index.md#Response) ### _async method_ `setup()` {#Session-setup} @@ -52,7 +49,6 @@ pip install nonebot2[httpx] empty - **返回** - - None ### _async method_ `close()` {#Session-close} @@ -62,7 +58,6 @@ pip install nonebot2[httpx] empty - **返回** - - None ## _class_ `Mixin()` {#Mixin} @@ -76,17 +71,14 @@ pip install nonebot2[httpx] ### _async method_ `request(setup)` {#Mixin-request} - **参数** - - `setup` ([Request](index.md#Request)) - **返回** - - [Response](index.md#Response) ### _method_ `get_session(params=None, headers=None, cookies=None, version=HTTPVersion.H11, timeout=None, proxy=None)` {#Mixin-get-session} - **参数** - - `params` (QueryTypes) - `headers` (HeaderTypes) @@ -100,13 +92,11 @@ pip install nonebot2[httpx] - `proxy` (str | None) - **返回** - - Session ## _class_ `Driver(env, config)` {#Driver} - **参数** - - `env` ([Env](../config.md#Env)) - `config` ([Config](../config.md#Config)) diff --git a/website/versioned_docs/version-2.4.2/api/drivers/index.md b/website/versioned_docs/version-2.4.2/api/drivers/index.md index 50aff1fe..b44384e1 100644 --- a/website/versioned_docs/version-2.4.2/api/drivers/index.md +++ b/website/versioned_docs/version-2.4.2/api/drivers/index.md @@ -40,11 +40,9 @@ description: nonebot.drivers 模块 - **说明:** 设置一个 HTTP 服务器路由配置 - **参数** - - `setup` ([HTTPServerSetup](#HTTPServerSetup)) - **返回** - - None ### _abstract method_ `setup_websocket_server(setup)` {#ASGIMixin-setup-websocket-server} @@ -52,23 +50,19 @@ description: nonebot.drivers 模块 - **说明:** 设置一个 WebSocket 服务器路由配置 - **参数** - - `setup` ([WebSocketServerSetup](#WebSocketServerSetup)) - **返回** - - None ## _class_ `Cookies(cookies=None)` {#Cookies} - **参数** - - `cookies` (CookieTypes) ### _method_ `set(name, value, domain="", path="/")` {#Cookies-set} - **参数** - - `name` (str) - `value` (str) @@ -78,13 +72,11 @@ description: nonebot.drivers 模块 - `path` (str) - **返回** - - None ### _method_ `get(name, default=None, domain=None, path=None)` {#Cookies-get} - **参数** - - `name` (str) - `default` (str | None) @@ -94,13 +86,11 @@ description: nonebot.drivers 模块 - `path` (str | None) - **返回** - - str | None ### _method_ `delete(name, domain=None, path=None)` {#Cookies-delete} - **参数** - - `name` (str) - `domain` (str | None) @@ -108,39 +98,32 @@ description: nonebot.drivers 模块 - `path` (str | None) - **返回** - - None ### _method_ `clear(domain=None, path=None)` {#Cookies-clear} - **参数** - - `domain` (str | None) - `path` (str | None) - **返回** - - None ### _method_ `update(cookies=None)` {#Cookies-update} - **参数** - - `cookies` (CookieTypes) - **返回** - - None ### _method_ `as_header(request)` {#Cookies-as-header} - **参数** - - `request` (Request) - **返回** - - dict[str, str] ## _abstract class_ `Driver(env, config)` {#Driver} @@ -152,7 +135,6 @@ description: nonebot.drivers 模块 驱动器控制框架的启动和停止,适配器的注册,以及机器人生命周期管理。 - **参数** - - `env` ([Env](../config.md#Env)): 包含环境信息的 Env 对象 - `config` ([Config](../config.md#Config)): 包含配置信息的 Config 对象 @@ -180,13 +162,11 @@ description: nonebot.drivers 模块 - **说明:** 注册一个协议适配器 - **参数** - - `adapter` (type[[Adapter](../adapters/index.md#Adapter)]): 适配器类 - `**kwargs`: 其他传递给适配器的参数 - **返回** - - None ### _abstract property_ `type` {#Driver-type} @@ -206,13 +186,11 @@ description: nonebot.drivers 模块 - **说明:** 启动驱动框架 - **参数** - - `*args` - `**kwargs` - **返回** - - untyped ### _method_ `on_startup(func)` {#Driver-on-startup} @@ -220,11 +198,9 @@ description: nonebot.drivers 模块 - **说明:** 注册一个启动时执行的函数 - **参数** - - `func` (LIFESPAN_FUNC) - **返回** - - LIFESPAN_FUNC ### _method_ `on_shutdown(func)` {#Driver-on-shutdown} @@ -232,11 +208,9 @@ description: nonebot.drivers 模块 - **说明:** 注册一个停止时执行的函数 - **参数** - - `func` (LIFESPAN_FUNC) - **返回** - - LIFESPAN_FUNC ### _classmethod_ `on_bot_connect(func)` {#Driver-on-bot-connect} @@ -246,15 +220,12 @@ description: nonebot.drivers 模块 装饰一个函数使他在 bot 连接成功时执行。 钩子函数参数: - - bot: 当前连接上的 Bot 对象 - **参数** - - `func` ([T_BotConnectionHook](../typing.md#T-BotConnectionHook)) - **返回** - - [T_BotConnectionHook](../typing.md#T-BotConnectionHook) ### _classmethod_ `on_bot_disconnect(func)` {#Driver-on-bot-disconnect} @@ -264,15 +235,12 @@ description: nonebot.drivers 模块 装饰一个函数使他在 bot 连接断开时执行。 钩子函数参数: - - bot: 当前连接上的 Bot 对象 - **参数** - - `func` ([T_BotDisconnectionHook](../typing.md#T-BotDisconnectionHook)) - **返回** - - [T_BotDisconnectionHook](../typing.md#T-BotDisconnectionHook) ## _var_ `ForwardDriver` {#ForwardDriver} @@ -306,11 +274,9 @@ description: nonebot.drivers 模块 - **说明:** 发送一个 HTTP 请求 - **参数** - - `setup` ([Request](#Request)) - **返回** - - [Response](#Response) ### _abstract method_ `get_session(params=None, headers=None, cookies=None, version=HTTPVersion.H11, timeout=None, proxy=None)` {#HTTPClientMixin-get-session} @@ -318,7 +284,6 @@ description: nonebot.drivers 模块 - **说明:** 获取一个 HTTP 会话 - **参数** - - `params` (QueryTypes) - `headers` (HeaderTypes) @@ -332,7 +297,6 @@ description: nonebot.drivers 模块 - `proxy` (str | None) - **返回** - - HTTPClientSession ## _class_ `HTTPServerSetup()` {#HTTPServerSetup} @@ -350,7 +314,6 @@ description: nonebot.drivers 模块 - **参数** auto - - `H10: '1.0'` - `H11: '1.1'` @@ -374,7 +337,6 @@ description: nonebot.drivers 模块 ## _class_ `Request(method, url, *, params=None, headers=None, cookies=None, content=None, data=None, json=None, files=None, version=HTTPVersion.H11, timeout=None, proxy=None)` {#Request} - **参数** - - `method` (str | bytes) - `url` (URL | str | RawURL) @@ -402,7 +364,6 @@ description: nonebot.drivers 模块 ## _class_ `Response(status_code, *, headers=None, content=None, request=None)` {#Response} - **参数** - - `status_code` (int) - `headers` (HeaderTypes) @@ -432,7 +393,6 @@ description: nonebot.drivers 模块 ## _abstract class_ `WebSocket(*, request)` {#WebSocket} - **参数** - - `request` (Request) ### _abstract property_ `closed` {#WebSocket-closed} @@ -450,7 +410,6 @@ description: nonebot.drivers 模块 empty - **返回** - - None ### _abstract async method_ `close(code=1000, reason="")` {#WebSocket-close} @@ -458,13 +417,11 @@ description: nonebot.drivers 模块 - **说明:** 关闭 WebSocket 连接请求 - **参数** - - `code` (int) - `reason` (str) - **返回** - - None ### _abstract async method_ `receive()` {#WebSocket-receive} @@ -476,7 +433,6 @@ description: nonebot.drivers 模块 empty - **返回** - - str | bytes ### _abstract async method_ `receive_text()` {#WebSocket-receive-text} @@ -488,7 +444,6 @@ description: nonebot.drivers 模块 empty - **返回** - - str ### _abstract async method_ `receive_bytes()` {#WebSocket-receive-bytes} @@ -500,7 +455,6 @@ description: nonebot.drivers 模块 empty - **返回** - - bytes ### _async method_ `send(data)` {#WebSocket-send} @@ -508,11 +462,9 @@ description: nonebot.drivers 模块 - **说明:** 发送一条 WebSocket text/bytes 信息 - **参数** - - `data` (str | bytes) - **返回** - - None ### _abstract async method_ `send_text(data)` {#WebSocket-send-text} @@ -520,11 +472,9 @@ description: nonebot.drivers 模块 - **说明:** 发送一条 WebSocket text 信息 - **参数** - - `data` (str) - **返回** - - None ### _abstract async method_ `send_bytes(data)` {#WebSocket-send-bytes} @@ -532,11 +482,9 @@ description: nonebot.drivers 模块 - **说明:** 发送一条 WebSocket binary 信息 - **参数** - - `data` (bytes) - **返回** - - None ## _abstract class_ `WebSocketClientMixin()` {#WebSocketClientMixin} @@ -552,11 +500,9 @@ description: nonebot.drivers 模块 - **说明:** 发起一个 WebSocket 连接 - **参数** - - `setup` ([Request](#Request)) - **返回** - - AsyncGenerator[[WebSocket](#WebSocket), None] ## _class_ `WebSocketServerSetup()` {#WebSocketServerSetup} @@ -574,19 +520,14 @@ description: nonebot.drivers 模块 - **重载** **1.** `(driver) -> type[D]` - - **参数** - - `driver` (type[D]) - **返回** - - type[D] **2.** `(driver, __m, /, *mixins) -> type[CombinedDriver]` - - **参数** - - `driver` (type[D]) - `__m` (type[[Mixin](#Mixin)]) @@ -594,5 +535,4 @@ description: nonebot.drivers 模块 - `*mixins` (type[[Mixin](#Mixin)]) - **返回** - - type[CombinedDriver] diff --git a/website/versioned_docs/version-2.4.2/api/drivers/none.md b/website/versioned_docs/version-2.4.2/api/drivers/none.md index 5ef1c558..5422d5dc 100644 --- a/website/versioned_docs/version-2.4.2/api/drivers/none.md +++ b/website/versioned_docs/version-2.4.2/api/drivers/none.md @@ -18,7 +18,6 @@ None 驱动适配 - **说明:** None 驱动框架 - **参数** - - `env` ([Env](../config.md#Env)) - `config` ([Config](../config.md#Config)) @@ -40,13 +39,11 @@ None 驱动适配 - **说明:** 启动 none driver - **参数** - - `*args` - `**kwargs` - **返回** - - untyped ### _method_ `exit(force=False)` {#Driver-exit} @@ -54,9 +51,7 @@ None 驱动适配 - **说明:** 退出 none driver - **参数** - - `force` (bool): 强制退出 - **返回** - - untyped diff --git a/website/versioned_docs/version-2.4.2/api/drivers/quart.md b/website/versioned_docs/version-2.4.2/api/drivers/quart.md index 508366fe..dd8dbb35 100644 --- a/website/versioned_docs/version-2.4.2/api/drivers/quart.md +++ b/website/versioned_docs/version-2.4.2/api/drivers/quart.md @@ -68,7 +68,6 @@ pip install nonebot2[quart] - **说明:** Quart 驱动框架 - **参数** - - `env` ([Env](../config.md#Env)) - `config` (NoneBotConfig) @@ -100,21 +99,17 @@ pip install nonebot2[quart] ### _method_ `setup_http_server(setup)` {#Driver-setup-http-server} - **参数** - - `setup` ([HTTPServerSetup](index.md#HTTPServerSetup)) - **返回** - - untyped ### _method_ `setup_websocket_server(setup)` {#Driver-setup-websocket-server} - **参数** - - `setup` ([WebSocketServerSetup](index.md#WebSocketServerSetup)) - **返回** - - None ### _method_ `run(host=None, port=None, *args, app=None, **kwargs)` {#Driver-run} @@ -122,7 +117,6 @@ pip install nonebot2[quart] - **说明:** 使用 `uvicorn` 启动 Quart - **参数** - - `host` (str | None) - `port` (int | None) @@ -134,7 +128,6 @@ pip install nonebot2[quart] - `**kwargs` - **返回** - - untyped ## _class_ `WebSocket(*, request, websocket_ctx)` {#WebSocket} @@ -142,7 +135,6 @@ pip install nonebot2[quart] - **说明:** Quart WebSocket Wrapper - **参数** - - `request` (BaseRequest) - `websocket_ctx` (WebsocketContext) @@ -154,19 +146,16 @@ pip install nonebot2[quart] empty - **返回** - - untyped ### _async method_ `close(code=1000, reason="")` {#WebSocket-close} - **参数** - - `code` (int) - `reason` (str) - **返回** - - untyped ### _async method_ `receive()` {#WebSocket-receive} @@ -176,7 +165,6 @@ pip install nonebot2[quart] empty - **返回** - - str | bytes ### _async method_ `receive_text()` {#WebSocket-receive-text} @@ -186,7 +174,6 @@ pip install nonebot2[quart] empty - **返回** - - str ### _async method_ `receive_bytes()` {#WebSocket-receive-bytes} @@ -196,25 +183,20 @@ pip install nonebot2[quart] empty - **返回** - - bytes ### _async method_ `send_text(data)` {#WebSocket-send-text} - **参数** - - `data` (str) - **返回** - - untyped ### _async method_ `send_bytes(data)` {#WebSocket-send-bytes} - **参数** - - `data` (bytes) - **返回** - - untyped diff --git a/website/versioned_docs/version-2.4.2/api/drivers/websockets.md b/website/versioned_docs/version-2.4.2/api/drivers/websockets.md index ce36fb93..f5a8166c 100644 --- a/website/versioned_docs/version-2.4.2/api/drivers/websockets.md +++ b/website/versioned_docs/version-2.4.2/api/drivers/websockets.md @@ -22,11 +22,9 @@ pip install nonebot2[websockets] ## _def_ `catch_closed(func)` {#catch-closed} - **参数** - - `func` ((P) -> CoroutineType[Any, Any, T]) - **返回** - - (P) -> CoroutineType[Any, Any, T] ## _class_ `Mixin()` {#Mixin} @@ -40,11 +38,9 @@ pip install nonebot2[websockets] ### _method_ `websocket(setup)` {#Mixin-websocket} - **参数** - - `setup` ([Request](index.md#Request)) - **返回** - - AsyncGenerator[[WebSocket](index.md#WebSocket), None] ## _class_ `WebSocket(*, request, websocket)` {#WebSocket} @@ -52,7 +48,6 @@ pip install nonebot2[websockets] - **说明:** Websockets WebSocket Wrapper - **参数** - - `request` ([Request](index.md#Request)) - `websocket` (WebSocketClientProtocol) @@ -64,19 +59,16 @@ pip install nonebot2[websockets] empty - **返回** - - untyped ### _async method_ `close(code=1000, reason="")` {#WebSocket-close} - **参数** - - `code` (int) - `reason` (str) - **返回** - - untyped ### _async method_ `receive()` {#WebSocket-receive} @@ -86,7 +78,6 @@ pip install nonebot2[websockets] empty - **返回** - - str | bytes ### _async method_ `receive_text()` {#WebSocket-receive-text} @@ -96,7 +87,6 @@ pip install nonebot2[websockets] empty - **返回** - - str ### _async method_ `receive_bytes()` {#WebSocket-receive-bytes} @@ -106,33 +96,27 @@ pip install nonebot2[websockets] empty - **返回** - - bytes ### _async method_ `send_text(data)` {#WebSocket-send-text} - **参数** - - `data` (str) - **返回** - - None ### _async method_ `send_bytes(data)` {#WebSocket-send-bytes} - **参数** - - `data` (bytes) - **返回** - - None ## _class_ `Driver(env, config)` {#Driver} - **参数** - - `env` ([Env](../config.md#Env)) - `config` ([Config](../config.md#Config)) diff --git a/website/versioned_docs/version-2.4.2/api/exception.md b/website/versioned_docs/version-2.4.2/api/exception.md index 823332c4..0365e1fd 100644 --- a/website/versioned_docs/version-2.4.2/api/exception.md +++ b/website/versioned_docs/version-2.4.2/api/exception.md @@ -62,7 +62,6 @@ NoneBotException - **说明:** 指示 NoneBot 应该忽略该事件。可由 PreProcessor 抛出。 - **参数** - - `reason`: 忽略事件的原因 ## _class_ `SkippedException()` {#SkippedException} @@ -101,7 +100,6 @@ NoneBotException - **说明:** 指示 NoneBot 阻止本次 API 调用或修改本次调用返回值,并返回自定义内容。 可由 api hook 抛出。 - **参数** - - `result`: 返回的内容 ## _class_ `StopPropagation()` {#StopPropagation} @@ -200,7 +198,6 @@ NoneBotException - **说明:** 代表 `Adapter` 抛出的异常,所有的 `Adapter` 都要在内部继承自这个 `Exception`。 - **参数** - - `adapter_name`: 标识 adapter ## _class_ `NoLogException()` {#NoLogException} diff --git a/website/versioned_docs/version-2.4.2/api/index.md b/website/versioned_docs/version-2.4.2/api/index.md index aecfab21..56305d35 100644 --- a/website/versioned_docs/version-2.4.2/api/index.md +++ b/website/versioned_docs/version-2.4.2/api/index.md @@ -60,11 +60,9 @@ description: nonebot 模块 empty - **返回** - - [Driver](drivers/index.md#Driver): 全局 [Driver](drivers/index.md#Driver) 对象 - **异常** - - ValueError: 全局 [Driver](drivers/index.md#Driver) 对象尚未初始化 ([nonebot.init](#init) 尚未调用) - **用法** @@ -80,27 +78,20 @@ description: nonebot 模块 - **重载** **1.** `(name) -> Adapter` - - **参数** - - `name` (str): 适配器名称 - **返回** - - [Adapter](adapters/index.md#Adapter): 指定名称的 [Adapter](adapters/index.md#Adapter) 对象 **2.** `(name) -> A` - - **参数** - - `name` (type[A]): 适配器类型 - **返回** - - A: 指定类型的 [Adapter](adapters/index.md#Adapter) 对象 - **异常** - - ValueError: 指定的 [Adapter](adapters/index.md#Adapter) 未注册 - ValueError: 全局 [Driver](drivers/index.md#Driver) 对象尚未初始化 ([nonebot.init](#init) 尚未调用) @@ -121,11 +112,9 @@ description: nonebot 模块 empty - **返回** - - dict[str, [Adapter](adapters/index.md#Adapter)]: 所有 [Adapter](adapters/index.md#Adapter) 实例字典 - **异常** - - ValueError: 全局 [Driver](drivers/index.md#Driver) 对象尚未初始化 ([nonebot.init](#init) 尚未调用) - **用法** @@ -143,11 +132,9 @@ description: nonebot 模块 empty - **返回** - - Any: Server App 对象 - **异常** - - AssertionError: 全局 Driver 对象不是 [ASGIMixin](drivers/index.md#ASGIMixin) 类型 - ValueError: 全局 [Driver](drivers/index.md#Driver) 对象尚未初始化 ([nonebot.init](#init) 尚未调用) @@ -167,11 +154,9 @@ description: nonebot 模块 empty - **返回** - - Any: ASGI 对象 - **异常** - - AssertionError: 全局 Driver 对象不是 [ASGIMixin](drivers/index.md#ASGIMixin) 类型 - ValueError: 全局 [Driver](drivers/index.md#Driver) 对象尚未初始化 ([nonebot.init](#init) 尚未调用) @@ -192,15 +177,12 @@ description: nonebot 模块 当不提供时,返回一个 [Bot](adapters/index.md#Bot)。 - **参数** - - `self_id` (str | None): 用来识别 [Bot](adapters/index.md#Bot) 的 [Bot.self_id](adapters/index.md#Bot-self-id) 属性 - **返回** - - [Bot](adapters/index.md#Bot): [Bot](adapters/index.md#Bot) 对象 - **异常** - - KeyError: 对应 self_id 的 Bot 不存在 - ValueError: 没有传入 self_id 且没有 Bot 可用 @@ -224,13 +206,11 @@ description: nonebot 模块 empty - **返回** - - dict[str, [Bot](adapters/index.md#Bot)]: 一个以 [Bot.self_id](adapters/index.md#Bot-self-id) 为键 [Bot](adapters/index.md#Bot) 对象为值的字典 - **异常** - - ValueError: 全局 [Driver](drivers/index.md#Driver) 对象尚未初始化 ([nonebot.init](#init) 尚未调用) - **用法** @@ -250,13 +230,11 @@ description: nonebot 模块 也可以传入自定义的 `_env_file` 来指定 NoneBot 从该文件读取配置。 - **参数** - - `_env_file` (DOTENV_TYPE | None): 配置文件名,默认从 `.env.{env_name}` 中读取配置 - `**kwargs` (Any): 任意变量,将会存储到 [Driver.config](drivers/index.md#Driver-config) 对象里 - **返回** - - None - **用法** @@ -270,13 +248,11 @@ description: nonebot 模块 - **说明:** 启动 NoneBot,即运行全局 [Driver](drivers/index.md#Driver) 对象。 - **参数** - - `*args` (Any): 传入 [Driver.run](drivers/index.md#Driver-run) 的位置参数 - `**kwargs` (Any): 传入 [Driver.run](drivers/index.md#Driver-run) 的命名参数 - **返回** - - None - **用法** diff --git a/website/versioned_docs/version-2.4.2/api/log.md b/website/versioned_docs/version-2.4.2/api/log.md index 18bf08d6..636847e5 100644 --- a/website/versioned_docs/version-2.4.2/api/log.md +++ b/website/versioned_docs/version-2.4.2/api/log.md @@ -25,7 +25,6 @@ NoneBot 使用 [`loguru`][loguru] 来记录日志信息。 NoneBot 日志记录器对象。 默认信息: - - 格式: `[%(asctime)s %(name)s] %(levelname)s: %(message)s` - 等级: `INFO` ,根据 `config.log_level` 配置改变 - 输出: 输出至 stdout @@ -47,11 +46,9 @@ NoneBot 使用 [`loguru`][loguru] 来记录日志信息。 ### _method_ `emit(record)` {#LoguruHandler-emit} - **参数** - - `record` (logging.LogRecord) - **返回** - - untyped ## _def_ `default_filter(record)` {#default-filter} @@ -59,11 +56,9 @@ NoneBot 使用 [`loguru`][loguru] 来记录日志信息。 - **说明:** 默认的日志过滤器,根据 `config.log_level` 配置改变日志等级。 - **参数** - - `record` (Record) - **返回** - - untyped ## _var_ `default_format` {#default-format} diff --git a/website/versioned_docs/version-2.4.2/api/matcher.md b/website/versioned_docs/version-2.4.2/api/matcher.md index 3b745786..6f0cc08b 100644 --- a/website/versioned_docs/version-2.4.2/api/matcher.md +++ b/website/versioned_docs/version-2.4.2/api/matcher.md @@ -76,7 +76,6 @@ description: nonebot.matcher 模块 - **说明:** 创建一个新的事件响应器,并存储至 `matchers <#matchers>`\_ - **参数** - - `type_` (str): 事件响应器类型,与 `event.get_type()` 一致时触发,空字符串表示任意 - `rule` ([Rule](rule.md#Rule) | None): 匹配规则 @@ -106,7 +105,6 @@ description: nonebot.matcher 模块 - `default_permission_updater` ([T_PermissionUpdater](typing.md#T-PermissionUpdater) | [Dependent](dependencies/index.md#Dependent)[[Permission](permission.md#Permission)] | None): 默认会话权限更新函数 - **返回** - - type[Matcher]: 新的事件响应器类 ### _classmethod_ `destroy()` {#Matcher-destroy} @@ -118,7 +116,6 @@ description: nonebot.matcher 模块 empty - **返回** - - None ### _classmethod_ `check_perm(bot, event, stack=None, dependency_cache=None)` {#Matcher-check-perm} @@ -126,7 +123,6 @@ description: nonebot.matcher 模块 - **说明:** 检查是否满足触发权限 - **参数** - - `bot` ([Bot](adapters/index.md#Bot)): Bot 对象 - `event` ([Event](adapters/index.md#Event)): 上报事件 @@ -136,7 +132,6 @@ description: nonebot.matcher 模块 - `dependency_cache` ([T_DependencyCache](typing.md#T-DependencyCache) | None): 依赖缓存 - **返回** - - bool: 是否满足权限 ### _classmethod_ `check_rule(bot, event, state, stack=None, dependency_cache=None)` {#Matcher-check-rule} @@ -144,7 +139,6 @@ description: nonebot.matcher 模块 - **说明:** 检查是否满足匹配规则 - **参数** - - `bot` ([Bot](adapters/index.md#Bot)): Bot 对象 - `event` ([Event](adapters/index.md#Event)): 上报事件 @@ -156,7 +150,6 @@ description: nonebot.matcher 模块 - `dependency_cache` ([T_DependencyCache](typing.md#T-DependencyCache) | None): 依赖缓存 - **返回** - - bool: 是否满足匹配规则 ### _classmethod_ `type_updater(func)` {#Matcher-type-updater} @@ -164,11 +157,9 @@ description: nonebot.matcher 模块 - **说明:** 装饰一个函数来更改当前事件响应器的默认响应事件类型更新函数 - **参数** - - `func` ([T_TypeUpdater](typing.md#T-TypeUpdater)): 响应事件类型更新函数 - **返回** - - [T_TypeUpdater](typing.md#T-TypeUpdater) ### _classmethod_ `permission_updater(func)` {#Matcher-permission-updater} @@ -176,23 +167,19 @@ description: nonebot.matcher 模块 - **说明:** 装饰一个函数来更改当前事件响应器的默认会话权限更新函数 - **参数** - - `func` ([T_PermissionUpdater](typing.md#T-PermissionUpdater)): 会话权限更新函数 - **返回** - - [T_PermissionUpdater](typing.md#T-PermissionUpdater) ### _classmethod_ `append_handler(handler, parameterless=None)` {#Matcher-append-handler} - **参数** - - `handler` ([T_Handler](typing.md#T-Handler)) - `parameterless` (Iterable[Any] | None) - **返回** - - [Dependent](dependencies/index.md#Dependent)[Any] ### _classmethod_ `handle(parameterless=None)` {#Matcher-handle} @@ -200,11 +187,9 @@ description: nonebot.matcher 模块 - **说明:** 装饰一个函数来向事件响应器直接添加一个处理函数 - **参数** - - `parameterless` (Iterable[Any] | None): 非参数类型依赖列表 - **返回** - - ([T_Handler](typing.md#T-Handler)) -> [T_Handler](typing.md#T-Handler) ### _classmethod_ `receive(id="", parameterless=None)` {#Matcher-receive} @@ -212,13 +197,11 @@ description: nonebot.matcher 模块 - **说明:** 装饰一个函数来指示 NoneBot 在接收用户新的一条消息后继续运行该函数 - **参数** - - `id` (str): 消息 ID - `parameterless` (Iterable[Any] | None): 非参数类型依赖列表 - **返回** - - ([T_Handler](typing.md#T-Handler)) -> [T_Handler](typing.md#T-Handler) ### _classmethod_ `got(key, prompt=None, parameterless=None)` {#Matcher-got} @@ -231,7 +214,6 @@ description: nonebot.matcher 模块 如果 `key` 已存在则直接继续运行 - **参数** - - `key` (str): 参数名 - `prompt` (str | [Message](adapters/index.md#Message) | [MessageSegment](adapters/index.md#MessageSegment) | [MessageTemplate](adapters/index.md#MessageTemplate) | None): 在参数不存在时向用户发送的消息 @@ -239,7 +221,6 @@ description: nonebot.matcher 模块 - `parameterless` (Iterable[Any] | None): 非参数类型依赖列表 - **返回** - - ([T_Handler](typing.md#T-Handler)) -> [T_Handler](typing.md#T-Handler) ### _classmethod_ `send(message, **kwargs)` {#Matcher-send} @@ -247,13 +228,11 @@ description: nonebot.matcher 模块 - **说明:** 发送一条消息给当前交互用户 - **参数** - - `message` (str | [Message](adapters/index.md#Message) | [MessageSegment](adapters/index.md#MessageSegment) | [MessageTemplate](adapters/index.md#MessageTemplate)): 消息内容 - `**kwargs` (Any): [Bot.send](adapters/index.md#Bot-send) 的参数, 请参考对应 adapter 的 bot 对象 api - **返回** - - Any ### _classmethod_ `finish(message=None, **kwargs)` {#Matcher-finish} @@ -261,13 +240,11 @@ description: nonebot.matcher 模块 - **说明:** 发送一条消息给当前交互用户并结束当前事件响应器 - **参数** - - `message` (str | [Message](adapters/index.md#Message) | [MessageSegment](adapters/index.md#MessageSegment) | [MessageTemplate](adapters/index.md#MessageTemplate) | None): 消息内容 - `**kwargs`: [Bot.send](adapters/index.md#Bot-send) 的参数, 请参考对应 adapter 的 bot 对象 api - **返回** - - NoReturn ### _classmethod_ `pause(prompt=None, **kwargs)` {#Matcher-pause} @@ -275,13 +252,11 @@ description: nonebot.matcher 模块 - **说明:** 发送一条消息给当前交互用户并暂停事件响应器,在接收用户新的一条消息后继续下一个处理函数 - **参数** - - `prompt` (str | [Message](adapters/index.md#Message) | [MessageSegment](adapters/index.md#MessageSegment) | [MessageTemplate](adapters/index.md#MessageTemplate) | None): 消息内容 - `**kwargs`: [Bot.send](adapters/index.md#Bot-send) 的参数, 请参考对应 adapter 的 bot 对象 api - **返回** - - NoReturn ### _classmethod_ `reject(prompt=None, **kwargs)` {#Matcher-reject} @@ -289,13 +264,11 @@ description: nonebot.matcher 模块 - **说明:** 最近使用 `got` / `receive` 接收的消息不符合预期, 发送一条消息给当前交互用户并将当前事件处理流程中断在当前位置,在接收用户新的一个事件后从头开始执行当前处理函数 - **参数** - - `prompt` (str | [Message](adapters/index.md#Message) | [MessageSegment](adapters/index.md#MessageSegment) | [MessageTemplate](adapters/index.md#MessageTemplate) | None): 消息内容 - `**kwargs`: [Bot.send](adapters/index.md#Bot-send) 的参数, 请参考对应 adapter 的 bot 对象 api - **返回** - - NoReturn ### _classmethod_ `reject_arg(key, prompt=None, **kwargs)` {#Matcher-reject-arg} @@ -303,7 +276,6 @@ description: nonebot.matcher 模块 - **说明:** 最近使用 `got` 接收的消息不符合预期, 发送一条消息给当前交互用户并将当前事件处理流程中断在当前位置,在接收用户新的一条消息后从头开始执行当前处理函数 - **参数** - - `key` (str): 参数名 - `prompt` (str | [Message](adapters/index.md#Message) | [MessageSegment](adapters/index.md#MessageSegment) | [MessageTemplate](adapters/index.md#MessageTemplate) | None): 消息内容 @@ -311,7 +283,6 @@ description: nonebot.matcher 模块 - `**kwargs`: [Bot.send](adapters/index.md#Bot-send) 的参数, 请参考对应 adapter 的 bot 对象 api - **返回** - - NoReturn ### _classmethod_ `reject_receive(id="", prompt=None, **kwargs)` {#Matcher-reject-receive} @@ -319,7 +290,6 @@ description: nonebot.matcher 模块 - **说明:** 最近使用 `receive` 接收的消息不符合预期, 发送一条消息给当前交互用户并将当前事件处理流程中断在当前位置,在接收用户新的一个事件后从头开始执行当前处理函数 - **参数** - - `id` (str): 消息 id - `prompt` (str | [Message](adapters/index.md#Message) | [MessageSegment](adapters/index.md#MessageSegment) | [MessageTemplate](adapters/index.md#MessageTemplate) | None): 消息内容 @@ -327,7 +297,6 @@ description: nonebot.matcher 模块 - `**kwargs`: [Bot.send](adapters/index.md#Bot-send) 的参数, 请参考对应 adapter 的 bot 对象 api - **返回** - - NoReturn ### _classmethod_ `skip()` {#Matcher-skip} @@ -343,7 +312,6 @@ description: nonebot.matcher 模块 empty - **返回** - - NoReturn ### _method_ `get_receive(id, default=None)` {#Matcher-get-receive} @@ -357,25 +325,19 @@ description: nonebot.matcher 模块 - **重载** **1.** `(id) -> Event | None` - - **参数** - - `id` (str) - **返回** - - [Event](adapters/index.md#Event) | None **2.** `(id, default) -> Event | T` - - **参数** - - `id` (str) - `default` (T) - **返回** - - [Event](adapters/index.md#Event) | T ### _method_ `set_receive(id, event)` {#Matcher-set-receive} @@ -383,13 +345,11 @@ description: nonebot.matcher 模块 - **说明:** 设置一个 `receive` 事件 - **参数** - - `id` (str) - `event` ([Event](adapters/index.md#Event)) - **返回** - - None ### _method_ `get_last_receive(default=None)` {#Matcher-get-last-receive} @@ -403,23 +363,18 @@ description: nonebot.matcher 模块 - **重载** **1.** `() -> Event | None` - - **参数** empty - **返回** - - [Event](adapters/index.md#Event) | None **2.** `(default) -> Event | T` - - **参数** - - `default` (T) - **返回** - - [Event](adapters/index.md#Event) | T ### _method_ `get_arg(key, default=None)` {#Matcher-get-arg} @@ -433,25 +388,19 @@ description: nonebot.matcher 模块 - **重载** **1.** `(key) -> Message | None` - - **参数** - - `key` (str) - **返回** - - [Message](adapters/index.md#Message) | None **2.** `(key, default) -> Message | T` - - **参数** - - `key` (str) - `default` (T) - **返回** - - [Message](adapters/index.md#Message) | T ### _method_ `set_arg(key, message)` {#Matcher-set-arg} @@ -459,25 +408,21 @@ description: nonebot.matcher 模块 - **说明:** 设置一个 `got` 消息 - **参数** - - `key` (str) - `message` ([Message](adapters/index.md#Message)) - **返回** - - None ### _method_ `set_target(target, cache=True)` {#Matcher-set-target} - **参数** - - `target` (str) - `cache` (bool) - **返回** - - None ### _method_ `get_target(default=None)` {#Matcher-get-target} @@ -485,23 +430,18 @@ description: nonebot.matcher 模块 - **重载** **1.** `() -> str | None` - - **参数** empty - **返回** - - str | None **2.** `(default) -> str | T` - - **参数** - - `default` (T) - **返回** - - str | T ### _method_ `stop_propagation()` {#Matcher-stop-propagation} @@ -513,13 +453,11 @@ description: nonebot.matcher 模块 empty - **返回** - - untyped ### _async method_ `update_type(bot, event, stack=None, dependency_cache=None)` {#Matcher-update-type} - **参数** - - `bot` ([Bot](adapters/index.md#Bot)) - `event` ([Event](adapters/index.md#Event)) @@ -529,13 +467,11 @@ description: nonebot.matcher 模块 - `dependency_cache` ([T_DependencyCache](typing.md#T-DependencyCache) | None) - **返回** - - str ### _async method_ `update_permission(bot, event, stack=None, dependency_cache=None)` {#Matcher-update-permission} - **参数** - - `bot` ([Bot](adapters/index.md#Bot)) - `event` ([Event](adapters/index.md#Event)) @@ -545,7 +481,6 @@ description: nonebot.matcher 模块 - `dependency_cache` ([T_DependencyCache](typing.md#T-DependencyCache) | None) - **返回** - - [Permission](permission.md#Permission) ### _async method_ `resolve_reject()` {#Matcher-resolve-reject} @@ -555,25 +490,21 @@ description: nonebot.matcher 模块 empty - **返回** - - untyped ### _method_ `ensure_context(bot, event)` {#Matcher-ensure-context} - **参数** - - `bot` ([Bot](adapters/index.md#Bot)) - `event` ([Event](adapters/index.md#Event)) - **返回** - - untyped ### _async method_ `simple_run(bot, event, state, stack=None, dependency_cache=None)` {#Matcher-simple-run} - **参数** - - `bot` ([Bot](adapters/index.md#Bot)) - `event` ([Event](adapters/index.md#Event)) @@ -585,13 +516,11 @@ description: nonebot.matcher 模块 - `dependency_cache` ([T_DependencyCache](typing.md#T-DependencyCache) | None) - **返回** - - untyped ### _async method_ `run(bot, event, state, stack=None, dependency_cache=None)` {#Matcher-run} - **参数** - - `bot` ([Bot](adapters/index.md#Bot)) - `event` ([Event](adapters/index.md#Event)) @@ -603,7 +532,6 @@ description: nonebot.matcher 模块 - `dependency_cache` ([T_DependencyCache](typing.md#T-DependencyCache) | None) - **返回** - - untyped ## _class_ `MatcherManager()` {#MatcherManager} @@ -625,7 +553,6 @@ description: nonebot.matcher 模块 empty - **返回** - - KeysView[int] ### _method_ `values()` {#MatcherManager-values} @@ -635,7 +562,6 @@ description: nonebot.matcher 模块 empty - **返回** - - ValuesView[list[type[[Matcher](#Matcher)]]] ### _method_ `items()` {#MatcherManager-items} @@ -645,7 +571,6 @@ description: nonebot.matcher 模块 empty - **返回** - - ItemsView[int, list[type[[Matcher](#Matcher)]]] ### _method_ `get(key, default=None)` {#MatcherManager-get} @@ -653,35 +578,27 @@ description: nonebot.matcher 模块 - **重载** **1.** `(key) -> list[type[Matcher]] | None` - - **参数** - - `key` (int) - **返回** - - list[type[[Matcher](#Matcher)]] | None **2.** `(key, default) -> list[type[Matcher]] | T` - - **参数** - - `key` (int) - `default` (T) - **返回** - - list[type[[Matcher](#Matcher)]] | T ### _method_ `pop(key)` {#MatcherManager-pop} - **参数** - - `key` (int) - **返回** - - list[type[[Matcher](#Matcher)]] ### _method_ `popitem()` {#MatcherManager-popitem} @@ -691,7 +608,6 @@ description: nonebot.matcher 模块 empty - **返回** - - tuple[int, list[type[[Matcher](#Matcher)]]] ### _method_ `clear()` {#MatcherManager-clear} @@ -701,29 +617,24 @@ description: nonebot.matcher 模块 empty - **返回** - - None ### _method_ `update(m, /)` {#MatcherManager-update} - **参数** - - `m` (MutableMapping[int, list[type[[Matcher](#Matcher)]]]) - **返回** - - None ### _method_ `setdefault(key, default)` {#MatcherManager-setdefault} - **参数** - - `key` (int) - `default` (list[type[[Matcher](#Matcher)]]) - **返回** - - list[type[[Matcher](#Matcher)]] ### _method_ `set_provider(provider_class)` {#MatcherManager-set-provider} @@ -731,11 +642,9 @@ description: nonebot.matcher 模块 - **说明:** 设置事件响应器存储器 - **参数** - - `provider_class` (type[[MatcherProvider](#MatcherProvider)]): 事件响应器存储器类 - **返回** - - None ## _abstract class_ `MatcherProvider(matchers)` {#MatcherProvider} @@ -743,7 +652,6 @@ description: nonebot.matcher 模块 - **说明:** 事件响应器存储器基类 - **参数** - - `matchers` (Mapping[int, list[type[[Matcher](#Matcher)]]]): 当前存储器中已有的事件响应器 ## _var_ `matchers` {#matchers} diff --git a/website/versioned_docs/version-2.4.2/api/message.md b/website/versioned_docs/version-2.4.2/api/message.md index 73622df3..ad785e3d 100644 --- a/website/versioned_docs/version-2.4.2/api/message.md +++ b/website/versioned_docs/version-2.4.2/api/message.md @@ -20,11 +20,9 @@ NoneBot 内部处理并按优先级分发事件给所有事件响应器,提供 装饰一个函数,使它在每次接收到事件并分发给各响应器之前执行。 - **参数** - - `func` ([T_EventPreProcessor](typing.md#T-EventPreProcessor)) - **返回** - - [T_EventPreProcessor](typing.md#T-EventPreProcessor) ## _def_ `event_postprocessor(func)` {#event-postprocessor} @@ -36,11 +34,9 @@ NoneBot 内部处理并按优先级分发事件给所有事件响应器,提供 装饰一个函数,使它在每次接收到事件并分发给各响应器之后执行。 - **参数** - - `func` ([T_EventPostProcessor](typing.md#T-EventPostProcessor)) - **返回** - - [T_EventPostProcessor](typing.md#T-EventPostProcessor) ## _def_ `run_preprocessor(func)` {#run-preprocessor} @@ -52,11 +48,9 @@ NoneBot 内部处理并按优先级分发事件给所有事件响应器,提供 装饰一个函数,使它在每次事件响应器运行前执行。 - **参数** - - `func` ([T_RunPreProcessor](typing.md#T-RunPreProcessor)) - **返回** - - [T_RunPreProcessor](typing.md#T-RunPreProcessor) ## _def_ `run_postprocessor(func)` {#run-postprocessor} @@ -68,11 +62,9 @@ NoneBot 内部处理并按优先级分发事件给所有事件响应器,提供 装饰一个函数,使它在每次事件响应器运行后执行。 - **参数** - - `func` ([T_RunPostProcessor](typing.md#T-RunPostProcessor)) - **返回** - - [T_RunPostProcessor](typing.md#T-RunPostProcessor) ## _async def_ `check_and_run_matcher(Matcher, bot, event, state, stack=None, dependency_cache=None)` {#check-and-run-matcher} @@ -80,7 +72,6 @@ NoneBot 内部处理并按优先级分发事件给所有事件响应器,提供 - **说明:** 检查并运行事件响应器。 - **参数** - - `Matcher` (type[[Matcher](matcher.md#Matcher)]): 事件响应器 - `bot` ([Bot](adapters/index.md#Bot)): Bot 对象 @@ -94,7 +85,6 @@ NoneBot 内部处理并按优先级分发事件给所有事件响应器,提供 - `dependency_cache` ([T_DependencyCache](typing.md#T-DependencyCache) | None): 依赖缓存 - **返回** - - None ## _async def_ `handle_event(bot, event)` {#handle-event} @@ -102,13 +92,11 @@ NoneBot 内部处理并按优先级分发事件给所有事件响应器,提供 - **说明:** 处理一个事件。调用该函数以实现分发事件。 - **参数** - - `bot` ([Bot](adapters/index.md#Bot)): Bot 对象 - `event` ([Event](adapters/index.md#Event)): Event 对象 - **返回** - - None - **用法** diff --git a/website/versioned_docs/version-2.4.2/api/params.md b/website/versioned_docs/version-2.4.2/api/params.md index 0af076cb..9f5775c0 100644 --- a/website/versioned_docs/version-2.4.2/api/params.md +++ b/website/versioned_docs/version-2.4.2/api/params.md @@ -14,11 +14,9 @@ description: nonebot.params 模块 - **说明:** Arg 参数消息 - **参数** - - `key` (str | None) - **返回** - - Any ## _class_ `ArgParam(*args, key, type, **kwargs)` {#ArgParam} @@ -33,7 +31,6 @@ description: nonebot.params 模块 留空则会根据参数名称获取。 - **参数** - - `*args` - `key` (str) @@ -47,11 +44,9 @@ description: nonebot.params 模块 - **说明:** Arg 参数消息纯文本 - **参数** - - `key` (str | None) - **返回** - - str ## _def_ `ArgPromptResult(key=None)` {#ArgPromptResult} @@ -59,11 +54,9 @@ description: nonebot.params 模块 - **说明:** `arg` prompt 发送结果 - **参数** - - `key` (str | None) - **返回** - - Any ## _def_ `ArgStr(key=None)` {#ArgStr} @@ -71,11 +64,9 @@ description: nonebot.params 模块 - **说明:** Arg 参数消息文本 - **参数** - - `key` (str | None) - **返回** - - str ## _class_ `BotParam(*args, checker=None, **kwargs)` {#BotParam} @@ -89,7 +80,6 @@ description: nonebot.params 模块 为保证兼容性,本注入还会解析名为 `bot` 且没有类型注解的参数。 - **参数** - - `*args` - `checker` ([ModelField](compat.md#ModelField) | None) @@ -107,7 +97,6 @@ description: nonebot.params 模块 本注入参数应该具有最低优先级,因此应该在所有其他注入参数之后使用。 - **参数** - - `*args` - `validate` (bool) @@ -125,7 +114,6 @@ description: nonebot.params 模块 本注入应该具有最高优先级,因此应该在其他参数之前检查。 - **参数** - - `*args` - `dependent` ([Dependent](dependencies/index.md#Dependent)[Any]) @@ -139,7 +127,6 @@ description: nonebot.params 模块 - **说明:** 子依赖装饰器 - **参数** - - `dependency` ([T_Handler](typing.md#T-Handler) | None): 依赖函数。默认为参数的类型注释。 - `use_cache` (bool): 是否使用缓存。默认为 `True`。 @@ -147,7 +134,6 @@ description: nonebot.params 模块 - `validate` (bool | PydanticFieldInfo): 是否使用 Pydantic 类型校验。默认为 `False`。 - **返回** - - Any - **用法** @@ -180,7 +166,6 @@ description: nonebot.params 模块 为保证兼容性,本注入还会解析名为 `event` 且没有类型注解的参数。 - **参数** - - `*args` - `checker` ([ModelField](compat.md#ModelField) | None) @@ -198,7 +183,6 @@ description: nonebot.params 模块 为保证兼容性,本注入还会解析名为 `exception` 且没有类型注解的参数。 - **参数** - - `*args` - `validate` (bool) @@ -216,7 +200,6 @@ description: nonebot.params 模块 为保证兼容性,本注入还会解析名为 `matcher` 且没有类型注解的参数。 - **参数** - - `*args` - `checker` ([ModelField](compat.md#ModelField) | None) @@ -234,7 +217,6 @@ description: nonebot.params 模块 为保证兼容性,本注入还会解析名为 `state` 且没有类型注解的参数。 - **参数** - - `*args` - `validate` (bool) @@ -250,7 +232,6 @@ description: nonebot.params 模块 empty - **返回** - - str ## _def_ `EventMessage()` {#EventMessage} @@ -262,7 +243,6 @@ description: nonebot.params 模块 empty - **返回** - - Any ## _def_ `EventPlainText()` {#EventPlainText} @@ -274,7 +254,6 @@ description: nonebot.params 模块 empty - **返回** - - str ## _def_ `EventToMe()` {#EventToMe} @@ -286,7 +265,6 @@ description: nonebot.params 模块 empty - **返回** - - bool ## _def_ `Command()` {#Command} @@ -298,7 +276,6 @@ description: nonebot.params 模块 empty - **返回** - - tuple[str, ...] ## _def_ `RawCommand()` {#RawCommand} @@ -310,7 +287,6 @@ description: nonebot.params 模块 empty - **返回** - - str ## _def_ `CommandArg()` {#CommandArg} @@ -322,7 +298,6 @@ description: nonebot.params 模块 empty - **返回** - - Any ## _def_ `CommandStart()` {#CommandStart} @@ -334,7 +309,6 @@ description: nonebot.params 模块 empty - **返回** - - str ## _def_ `CommandWhitespace()` {#CommandWhitespace} @@ -346,7 +320,6 @@ description: nonebot.params 模块 empty - **返回** - - str ## _def_ `ShellCommandArgs()` {#ShellCommandArgs} @@ -358,7 +331,6 @@ description: nonebot.params 模块 empty - **返回** - - Any ## _def_ `ShellCommandArgv()` {#ShellCommandArgv} @@ -370,7 +342,6 @@ description: nonebot.params 模块 empty - **返回** - - Any ## _def_ `RegexMatched()` {#RegexMatched} @@ -382,7 +353,6 @@ description: nonebot.params 模块 empty - **返回** - - Match[str] ## _def_ `RegexStr(*groups)` {#RegexStr} @@ -392,29 +362,21 @@ description: nonebot.params 模块 - **重载** **1.** `(group, /) -> str` - - **参数** - - `group` (Literal[0]) - **返回** - - str **2.** `(group, /) -> str | Any` - - **参数** - - `group` (str | int) - **返回** - - str | Any **3.** `(group1, group2, /, *groups) -> tuple[str | Any, ...]` - - **参数** - - `group1` (str | int) - `group2` (str | int) @@ -422,7 +384,6 @@ description: nonebot.params 模块 - `*groups` (str | int) - **返回** - - tuple[str | Any, ...] ## _def_ `RegexGroup()` {#RegexGroup} @@ -434,7 +395,6 @@ description: nonebot.params 模块 empty - **返回** - - tuple[Any, ...] ## _def_ `RegexDict()` {#RegexDict} @@ -446,7 +406,6 @@ description: nonebot.params 模块 empty - **返回** - - dict[str, Any] ## _def_ `Startswith()` {#Startswith} @@ -458,7 +417,6 @@ description: nonebot.params 模块 empty - **返回** - - str ## _def_ `Endswith()` {#Endswith} @@ -470,7 +428,6 @@ description: nonebot.params 模块 empty - **返回** - - str ## _def_ `Fullmatch()` {#Fullmatch} @@ -482,7 +439,6 @@ description: nonebot.params 模块 empty - **返回** - - str ## _def_ `Keyword()` {#Keyword} @@ -494,7 +450,6 @@ description: nonebot.params 模块 empty - **返回** - - str ## _def_ `Received(id=None, default=None)` {#Received} @@ -502,13 +457,11 @@ description: nonebot.params 模块 - **说明:** `receive` 事件参数 - **参数** - - `id` (str | None) - `default` (Any) - **返回** - - Any ## _def_ `LastReceived(default=None)` {#LastReceived} @@ -516,11 +469,9 @@ description: nonebot.params 模块 - **说明:** `last_receive` 事件参数 - **参数** - - `default` (Any) - **返回** - - Any ## _def_ `ReceivePromptResult(id=None)` {#ReceivePromptResult} @@ -528,11 +479,9 @@ description: nonebot.params 模块 - **说明:** `receive` prompt 发送结果 - **参数** - - `id` (str | None) - **返回** - - Any ## _def_ `PausePromptResult()` {#PausePromptResult} @@ -544,5 +493,4 @@ description: nonebot.params 模块 empty - **返回** - - Any diff --git a/website/versioned_docs/version-2.4.2/api/permission.md b/website/versioned_docs/version-2.4.2/api/permission.md index a5df96c9..ac4775a8 100644 --- a/website/versioned_docs/version-2.4.2/api/permission.md +++ b/website/versioned_docs/version-2.4.2/api/permission.md @@ -22,7 +22,6 @@ description: nonebot.permission 模块 如果 `perm` 中仅有 `User` 类型的权限检查函数,则会去除原有检查函数的会话 ID 限制。 - **参数** - - `*users` (str) - `perm` (Permission | None): 需要同时满足的权限 @@ -30,7 +29,6 @@ description: nonebot.permission 模块 - `user`: 会话白名单 - **返回** - - untyped ## _class_ `Permission(*checkers)` {#Permission} @@ -42,7 +40,6 @@ description: nonebot.permission 模块 当事件传递时,在 [Matcher](matcher.md#Matcher) 运行前进行检查。 - **参数** - - `*checkers` ([T_PermissionChecker](typing.md#T-PermissionChecker) | [Dependent](dependencies/index.md#Dependent)[bool]): PermissionChecker - **用法** @@ -64,7 +61,6 @@ description: nonebot.permission 模块 - **说明:** 检查是否满足某个权限。 - **参数** - - `bot` ([Bot](adapters/index.md#Bot)): Bot 对象 - `event` ([Event](adapters/index.md#Event)): Event 对象 @@ -74,7 +70,6 @@ description: nonebot.permission 模块 - `dependency_cache` ([T_DependencyCache](typing.md#T-DependencyCache) | None): 依赖缓存 - **返回** - - bool ## _class_ `User(users, perm=None)` {#User} @@ -82,7 +77,6 @@ description: nonebot.permission 模块 - **说明:** 检查当前事件是否属于指定会话。 - **参数** - - `users` (tuple[str, ...]): 会话 ID 元组 - `perm` (Permission | None): 需同时满足的权限 @@ -96,13 +90,11 @@ description: nonebot.permission 模块 如果 `perm` 中仅有 `User` 类型的权限检查函数,则会去除原有的会话 ID 限制。 - **参数** - - `event` ([Event](adapters/index.md#Event)): Event 对象 - `perm` (Permission | None): 需同时满足的权限 - **返回** - - Self ### _classmethod_ `from_permission(*users, perm=None)` {#User-from-permission} @@ -114,13 +106,11 @@ description: nonebot.permission 模块 如果 `perm` 中仅有 `User` 类型的权限检查函数,则会去除原有的会话 ID 限制。 - **参数** - - `*users` (str): 会话白名单 - `perm` (Permission | None): 需同时满足的权限 - **返回** - - Self ## _class_ `Message()` {#Message} diff --git a/website/versioned_docs/version-2.4.2/api/plugin/index.md b/website/versioned_docs/version-2.4.2/api/plugin/index.md index 68c66d99..66acdfbb 100644 --- a/website/versioned_docs/version-2.4.2/api/plugin/index.md +++ b/website/versioned_docs/version-2.4.2/api/plugin/index.md @@ -51,11 +51,9 @@ description: nonebot.plugin 模块 如果为嵌套的子插件,标识符为 `父插件标识符:子插件文件(夹)名`。 - **参数** - - `plugin_id` (str): 插件标识符,即 [Plugin.id\_](model.md#Plugin-id-)。 - **返回** - - [Plugin](model.md#Plugin) | None ## _def_ `get_plugin_by_module_name(module_name)` {#get-plugin-by-module-name} @@ -67,11 +65,9 @@ description: nonebot.plugin 模块 如果提供的模块名为某个插件的子模块,同样会返回该插件。 - **参数** - - `module_name` (str): 模块名,即 [Plugin.module_name](model.md#Plugin-module-name)。 - **返回** - - [Plugin](model.md#Plugin) | None ## _def_ `get_loaded_plugins()` {#get-loaded-plugins} @@ -83,7 +79,6 @@ description: nonebot.plugin 模块 empty - **返回** - - set[[Plugin](model.md#Plugin)] ## _def_ `get_available_plugin_names()` {#get-available-plugin-names} @@ -95,7 +90,6 @@ description: nonebot.plugin 模块 empty - **返回** - - set[str] ## _def_ `get_plugin_config(config)` {#get-plugin-config} @@ -103,9 +97,7 @@ description: nonebot.plugin 模块 - **说明:** 从全局配置获取当前插件需要的配置项。 - **参数** - - `config` (type[C]) - **返回** - - C diff --git a/website/versioned_docs/version-2.4.2/api/plugin/load.md b/website/versioned_docs/version-2.4.2/api/plugin/load.md index 5c2a5a12..0fb7328f 100644 --- a/website/versioned_docs/version-2.4.2/api/plugin/load.md +++ b/website/versioned_docs/version-2.4.2/api/plugin/load.md @@ -14,11 +14,9 @@ description: nonebot.plugin.load 模块 - **说明:** 加载单个插件,可以是本地插件或是通过 `pip` 安装的插件。 - **参数** - - `module_path` (str | Path): 插件名称 `path.to.your.plugin` 或插件路径 `pathlib.Path(path/to/your/plugin)` - **返回** - - [Plugin](model.md#Plugin) | None ## _def_ `load_plugins(*plugin_dir)` {#load-plugins} @@ -26,11 +24,9 @@ description: nonebot.plugin.load 模块 - **说明:** 导入文件夹下多个插件,以 `_` 开头的插件不会被导入! - **参数** - - `*plugin_dir` (str): 文件夹路径 - **返回** - - set[[Plugin](model.md#Plugin)] ## _def_ `load_all_plugins(module_path, plugin_dir)` {#load-all-plugins} @@ -38,13 +34,11 @@ description: nonebot.plugin.load 模块 - **说明:** 导入指定列表中的插件以及指定目录下多个插件,以 `_` 开头的插件不会被导入! - **参数** - - `module_path` (Iterable[str]): 指定插件集合 - `plugin_dir` (Iterable[str]): 指定文件夹路径集合 - **返回** - - set[[Plugin](model.md#Plugin)] ## _def_ `load_from_json(file_path, encoding="utf-8")` {#load-from-json} @@ -52,13 +46,11 @@ description: nonebot.plugin.load 模块 - **说明:** 导入指定 json 文件中的 `plugins` 以及 `plugin_dirs` 下多个插件。 以 `_` 开头的插件不会被导入! - **参数** - - `file_path` (str): 指定 json 文件路径 - `encoding` (str): 指定 json 文件编码 - **返回** - - set[[Plugin](model.md#Plugin)] - **用法** @@ -79,13 +71,11 @@ description: nonebot.plugin.load 模块 - **说明:** 导入指定 toml 文件 `[tool.nonebot]` 中的 `plugins` 以及 `plugin_dirs` 下多个插件。 以 `_` 开头的插件不会被导入! - **参数** - - `file_path` (str): 指定 toml 文件路径 - `encoding` (str): 指定 toml 文件编码 - **返回** - - set[[Plugin](model.md#Plugin)] - **用法** @@ -105,11 +95,9 @@ description: nonebot.plugin.load 模块 - **说明:** 导入 NoneBot 内置插件。 - **参数** - - `name` (str): 插件名称 - **返回** - - [Plugin](model.md#Plugin) | None ## _def_ `load_builtin_plugins(*plugins)` {#load-builtin-plugins} @@ -117,11 +105,9 @@ description: nonebot.plugin.load 模块 - **说明:** 导入多个 NoneBot 内置插件。 - **参数** - - `*plugins` (str): 插件名称列表 - **返回** - - set[[Plugin](model.md#Plugin)] ## _def_ `require(name)` {#require} @@ -129,15 +115,12 @@ description: nonebot.plugin.load 模块 - **说明:** 声明依赖插件。 - **参数** - - `name` (str): 插件模块名或插件标识符,仅在已声明插件的情况下可使用标识符。 - **返回** - - ModuleType - **异常** - - RuntimeError: 插件无法加载 ## _def_ `inherit_supported_adapters(*names)` {#inherit-supported-adapters} @@ -149,15 +132,12 @@ description: nonebot.plugin.load 模块 如果传入了多个插件名称,返回值会自动取交集。 - **参数** - - `*names` (str): 插件名称列表。 - **返回** - - set[str] | None - **异常** - - RuntimeError: 插件未加载 - ValueError: 插件缺少元数据 diff --git a/website/versioned_docs/version-2.4.2/api/plugin/manager.md b/website/versioned_docs/version-2.4.2/api/plugin/manager.md index af32a84b..f9cc1da5 100644 --- a/website/versioned_docs/version-2.4.2/api/plugin/manager.md +++ b/website/versioned_docs/version-2.4.2/api/plugin/manager.md @@ -16,7 +16,6 @@ description: nonebot.plugin.manager 模块 - **说明:** 插件管理器。 - **参数** - - `plugins` (Iterable[str] | None): 独立插件模块名集合。 - `search_path` (Iterable[str] | None): 插件搜索路径(文件夹),相对于当前工作目录。 @@ -54,11 +53,9 @@ description: nonebot.plugin.manager 模块 可以使用完整插件模块名或者插件标识符加载。 - **参数** - - `name` (str): 插件名称或插件标识符。 - **返回** - - [Plugin](model.md#Plugin) | None ### _method_ `load_all_plugins()` {#PluginManager-load-all-plugins} @@ -70,7 +67,6 @@ description: nonebot.plugin.manager 模块 empty - **返回** - - set[[Plugin](model.md#Plugin)] ## _class_ `PluginFinder()` {#PluginFinder} @@ -82,7 +78,6 @@ description: nonebot.plugin.manager 模块 ### _method_ `find_spec(fullname, path, target=None)` {#PluginFinder-find-spec} - **参数** - - `fullname` (str) - `path` (Sequence[str] | None) @@ -90,13 +85,11 @@ description: nonebot.plugin.manager 模块 - `target` (ModuleType | None) - **返回** - - untyped ## _class_ `PluginLoader(manager, fullname, path)` {#PluginLoader} - **参数** - - `manager` (PluginManager) - `fullname` (str) @@ -106,19 +99,15 @@ description: nonebot.plugin.manager 模块 ### _method_ `create_module(spec)` {#PluginLoader-create-module} - **参数** - - `spec` - **返回** - - ModuleType | None ### _method_ `exec_module(module)` {#PluginLoader-exec-module} - **参数** - - `module` (ModuleType) - **返回** - - None diff --git a/website/versioned_docs/version-2.4.2/api/plugin/model.md b/website/versioned_docs/version-2.4.2/api/plugin/model.md index c87e6d73..b6f329df 100644 --- a/website/versioned_docs/version-2.4.2/api/plugin/model.md +++ b/website/versioned_docs/version-2.4.2/api/plugin/model.md @@ -80,7 +80,6 @@ description: nonebot.plugin.model 模块 empty - **返回** - - set[type[[Adapter](../adapters/index.md#Adapter)]] | None ## _class_ `Plugin()` {#Plugin} diff --git a/website/versioned_docs/version-2.4.2/api/plugin/on.md b/website/versioned_docs/version-2.4.2/api/plugin/on.md index 638bacaa..06bb3b20 100644 --- a/website/versioned_docs/version-2.4.2/api/plugin/on.md +++ b/website/versioned_docs/version-2.4.2/api/plugin/on.md @@ -14,11 +14,9 @@ description: nonebot.plugin.on 模块 - **说明:** 存储一个事件响应器到插件。 - **参数** - - `matcher` (type[[Matcher](../matcher.md#Matcher)]): 事件响应器 - **返回** - - None ## _def_ `get_matcher_plugin(depth=...)` {#get-matcher-plugin} @@ -30,11 +28,9 @@ description: nonebot.plugin.on 模块 **Deprecated**, 请使用 [get_matcher_source](#get-matcher-source) 获取信息。 - **参数** - - `depth` (int): 调用栈深度 - **返回** - - [Plugin](model.md#Plugin) | None ## _def_ `get_matcher_module(depth=...)` {#get-matcher-module} @@ -46,11 +42,9 @@ description: nonebot.plugin.on 模块 **Deprecated**, 请使用 [get_matcher_source](#get-matcher-source) 获取信息。 - **参数** - - `depth` (int): 调用栈深度 - **返回** - - ModuleType | None ## _def_ `get_matcher_source(depth=...)` {#get-matcher-source} @@ -58,11 +52,9 @@ description: nonebot.plugin.on 模块 - **说明:** 获取事件响应器定义所在源码信息。 - **参数** - - `depth` (int): 调用栈深度 - **返回** - - MatcherSource | None ## _def_ `on(type="", rule=..., permission=..., *, handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on} @@ -70,7 +62,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个基础事件响应器,可自定义类型。 - **参数** - - `type` (str): 事件响应器类型 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -90,7 +81,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_metaevent(rule=..., permission=..., *, handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-metaevent} @@ -98,7 +88,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个元事件响应器。 - **参数** - - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 - `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限 @@ -116,7 +105,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_message(rule=..., permission=..., *, handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-message} @@ -124,7 +112,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个消息事件响应器。 - **参数** - - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 - `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限 @@ -142,7 +129,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_notice(rule=..., permission=..., *, handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-notice} @@ -150,7 +136,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个通知事件响应器。 - **参数** - - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 - `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限 @@ -168,7 +153,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_request(rule=..., permission=..., *, handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-request} @@ -176,7 +160,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个请求事件响应器。 - **参数** - - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 - `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限 @@ -194,7 +177,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_startswith(msg, rule=..., ignorecase=..., *, permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-startswith} @@ -202,7 +184,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个消息事件响应器,并且当消息的**文本部分**以指定内容开头时响应。 - **参数** - - `msg` (str | tuple[str, ...]): 指定消息开头内容 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -224,7 +205,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_endswith(msg, rule=..., ignorecase=..., *, permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-endswith} @@ -232,7 +212,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个消息事件响应器,并且当消息的**文本部分**以指定内容结尾时响应。 - **参数** - - `msg` (str | tuple[str, ...]): 指定消息结尾内容 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -254,7 +233,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_fullmatch(msg, rule=..., ignorecase=..., *, permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-fullmatch} @@ -262,7 +240,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个消息事件响应器,并且当消息的**文本部分**与指定内容完全一致时响应。 - **参数** - - `msg` (str | tuple[str, ...]): 指定消息全匹配内容 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -284,7 +261,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_keyword(keywords, rule=..., *, permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-keyword} @@ -292,7 +268,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个消息事件响应器,并且当消息纯文本部分包含关键词时响应。 - **参数** - - `keywords` (set[str]): 关键词列表 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -312,7 +287,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_command(cmd, rule=..., aliases=..., force_whitespace=..., *, permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-command} @@ -324,7 +298,6 @@ description: nonebot.plugin.on 模块 命令匹配规则参考: `命令形式匹配 `\_ - **参数** - - `cmd` (str | tuple[str, ...]): 指定命令内容 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -348,7 +321,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_shell_command(cmd, rule=..., aliases=..., parser=..., *, permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-shell-command} @@ -363,7 +335,6 @@ description: nonebot.plugin.on 模块 通过 [ShellCommandArgs](../params.md#ShellCommandArgs) 获取解析后的参数字典。 - **参数** - - `cmd` (str | tuple[str, ...]): 指定命令内容 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -387,7 +358,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_regex(pattern, flags=..., rule=..., *, permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-regex} @@ -399,7 +369,6 @@ description: nonebot.plugin.on 模块 命令匹配规则参考: `正则匹配 `\_ - **参数** - - `pattern` (str): 正则表达式 - `flags` (int | re.RegexFlag): 正则匹配标志 @@ -421,7 +390,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_type(types, rule=..., *, permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-type} @@ -429,7 +397,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个事件响应器,并且当事件为指定类型时响应。 - **参数** - - `types` (type[[Event](../adapters/index.md#Event)] | tuple[type[[Event](../adapters/index.md#Event)], ...]): 事件类型 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -449,13 +416,11 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _class_ `CommandGroup(cmd, prefix_aliases=..., *, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#CommandGroup} - **参数** - - `cmd` (str | tuple[str, ...]) - `prefix_aliases` (bool) @@ -481,7 +446,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个新的命令。新参数将会覆盖命令组默认值 - **参数** - - `cmd` (str | tuple[str, ...]): 指定命令内容 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -505,7 +469,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `shell_command(cmd, *, rule=..., aliases=..., parser=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#CommandGroup-shell-command} @@ -513,7 +476,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个新的 `shell_like` 命令。新参数将会覆盖命令组默认值 - **参数** - - `cmd` (str | tuple[str, ...]): 指定命令内容 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -537,13 +499,11 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _class_ `MatcherGroup(*, type=..., rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup} - **参数** - - `type` (str) - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None) @@ -567,7 +527,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个基础事件响应器,可自定义类型。 - **参数** - - `type` (str): 事件响应器类型 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -587,7 +546,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_metaevent(*, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-metaevent} @@ -595,7 +553,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个元事件响应器。 - **参数** - - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 - `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限 @@ -613,7 +570,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_message(*, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-message} @@ -621,7 +577,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个消息事件响应器。 - **参数** - - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 - `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限 @@ -639,7 +594,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_notice(*, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-notice} @@ -647,7 +601,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个通知事件响应器。 - **参数** - - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 - `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限 @@ -665,7 +618,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_request(*, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-request} @@ -673,7 +625,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个请求事件响应器。 - **参数** - - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 - `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限 @@ -691,7 +642,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_startswith(msg, *, ignorecase=..., rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-startswith} @@ -699,7 +649,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个消息事件响应器,并且当消息的**文本部分**以指定内容开头时响应。 - **参数** - - `msg` (str | tuple[str, ...]): 指定消息开头内容 - `ignorecase` (bool): 是否忽略大小写 @@ -721,7 +670,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_endswith(msg, *, ignorecase=..., rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-endswith} @@ -729,7 +677,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个消息事件响应器,并且当消息的**文本部分**以指定内容结尾时响应。 - **参数** - - `msg` (str | tuple[str, ...]): 指定消息结尾内容 - `ignorecase` (bool): 是否忽略大小写 @@ -751,7 +698,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_fullmatch(msg, *, ignorecase=..., rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-fullmatch} @@ -759,7 +705,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个消息事件响应器,并且当消息的**文本部分**与指定内容完全一致时响应。 - **参数** - - `msg` (str | tuple[str, ...]): 指定消息全匹配内容 - `ignorecase` (bool): 是否忽略大小写 @@ -781,7 +726,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_keyword(keywords, *, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-keyword} @@ -789,7 +733,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个消息事件响应器,并且当消息纯文本部分包含关键词时响应。 - **参数** - - `keywords` (set[str]): 关键词列表 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -809,7 +752,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_command(cmd, aliases=..., force_whitespace=..., *, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-command} @@ -821,7 +763,6 @@ description: nonebot.plugin.on 模块 命令匹配规则参考: `命令形式匹配 `\_ - **参数** - - `cmd` (str | tuple[str, ...]): 指定命令内容 - `aliases` (set[str | tuple[str, ...]] | None): 命令别名 @@ -845,7 +786,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_shell_command(cmd, aliases=..., parser=..., *, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-shell-command} @@ -860,7 +800,6 @@ description: nonebot.plugin.on 模块 通过 [ShellCommandArgs](../params.md#ShellCommandArgs) 获取解析后的参数字典。 - **参数** - - `cmd` (str | tuple[str, ...]): 指定命令内容 - `aliases` (set[str | tuple[str, ...]] | None): 命令别名 @@ -884,7 +823,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_regex(pattern, flags=..., *, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-regex} @@ -896,7 +834,6 @@ description: nonebot.plugin.on 模块 命令匹配规则参考: `正则匹配 `\_ - **参数** - - `pattern` (str): 正则表达式 - `flags` (int | re.RegexFlag): 正则匹配标志 @@ -918,7 +855,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_type(types, *, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-type} @@ -926,7 +862,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个事件响应器,并且当事件为指定类型时响应。 - **参数** - - `types` (type[[Event](../adapters/index.md#Event)] | tuple[type[[Event](../adapters/index.md#Event)]]): 事件类型 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -946,5 +881,4 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] diff --git a/website/versioned_docs/version-2.4.2/api/rule.md b/website/versioned_docs/version-2.4.2/api/rule.md index 3307b13f..23b90248 100644 --- a/website/versioned_docs/version-2.4.2/api/rule.md +++ b/website/versioned_docs/version-2.4.2/api/rule.md @@ -22,7 +22,6 @@ description: nonebot.rule 模块 当事件传递时,在 [Matcher](matcher.md#Matcher) 运行前进行检查。 - **参数** - - `*checkers` ([T_RuleChecker](typing.md#T-RuleChecker) | [Dependent](dependencies/index.md#Dependent)[bool]): RuleChecker - **用法** @@ -44,7 +43,6 @@ description: nonebot.rule 模块 - **说明:** 检查是否符合所有规则 - **参数** - - `bot` ([Bot](adapters/index.md#Bot)): Bot 对象 - `event` ([Event](adapters/index.md#Event)): Event 对象 @@ -56,7 +54,6 @@ description: nonebot.rule 模块 - `dependency_cache` ([T_DependencyCache](typing.md#T-DependencyCache) | None): 依赖缓存 - **返回** - - bool ## _class_ `CMD_RESULT()` {#CMD-RESULT} @@ -78,7 +75,6 @@ description: nonebot.rule 模块 - **说明:** 检查消息纯文本是否以指定字符串开头。 - **参数** - - `msg` (tuple[str, ...]): 指定消息开头字符串元组 - `ignorecase` (bool): 是否忽略大小写 @@ -88,13 +84,11 @@ description: nonebot.rule 模块 - **说明:** 匹配消息纯文本开头。 - **参数** - - `msg` (str | tuple[str, ...]): 指定消息开头字符串元组 - `ignorecase` (bool): 是否忽略大小写 - **返回** - - [Rule](#Rule) ## _class_ `EndswithRule(msg, ignorecase=False)` {#EndswithRule} @@ -102,7 +96,6 @@ description: nonebot.rule 模块 - **说明:** 检查消息纯文本是否以指定字符串结尾。 - **参数** - - `msg` (tuple[str, ...]): 指定消息结尾字符串元组 - `ignorecase` (bool): 是否忽略大小写 @@ -112,13 +105,11 @@ description: nonebot.rule 模块 - **说明:** 匹配消息纯文本结尾。 - **参数** - - `msg` (str | tuple[str, ...]): 指定消息开头字符串元组 - `ignorecase` (bool): 是否忽略大小写 - **返回** - - [Rule](#Rule) ## _class_ `FullmatchRule(msg, ignorecase=False)` {#FullmatchRule} @@ -126,7 +117,6 @@ description: nonebot.rule 模块 - **说明:** 检查消息纯文本是否与指定字符串全匹配。 - **参数** - - `msg` (tuple[str, ...]): 指定消息全匹配字符串元组 - `ignorecase` (bool): 是否忽略大小写 @@ -136,13 +126,11 @@ description: nonebot.rule 模块 - **说明:** 完全匹配消息。 - **参数** - - `msg` (str | tuple[str, ...]): 指定消息全匹配字符串元组 - `ignorecase` (bool): 是否忽略大小写 - **返回** - - [Rule](#Rule) ## _class_ `KeywordsRule(*keywords)` {#KeywordsRule} @@ -150,7 +138,6 @@ description: nonebot.rule 模块 - **说明:** 检查消息纯文本是否包含指定关键字。 - **参数** - - `*keywords` (str): 指定关键字元组 ## _def_ `keyword(*keywords)` {#keyword} @@ -158,11 +145,9 @@ description: nonebot.rule 模块 - **说明:** 匹配消息纯文本关键词。 - **参数** - - `*keywords` (str): 指定关键字元组 - **返回** - - [Rule](#Rule) ## _class_ `CommandRule(cmds, force_whitespace=None)` {#CommandRule} @@ -170,7 +155,6 @@ description: nonebot.rule 模块 - **说明:** 检查消息是否为指定命令。 - **参数** - - `cmds` (list[tuple[str, ...]]): 指定命令元组列表 - `force_whitespace` (str | bool | None): 是否强制命令后必须有指定空白符 @@ -189,13 +173,11 @@ description: nonebot.rule 模块 通过 [CommandArg](params.md#CommandArg) 获取匹配成功的命令参数。 - **参数** - - `*cmds` (str | tuple[str, ...]): 命令文本或命令元组 - `force_whitespace` (str | bool | None): 是否强制命令后必须有指定空白符 - **返回** - - [Rule](#Rule) - **用法** @@ -231,37 +213,28 @@ description: nonebot.rule 模块 - **重载** **1.** `(args=None, namespace=None) -> tuple[Namespace, list[str | MessageSegment]]` - - **参数** - - `args` (Sequence[str | [MessageSegment](adapters/index.md#MessageSegment)] | None) - `namespace` (None) - **返回** - - tuple[Namespace, list[str | [MessageSegment](adapters/index.md#MessageSegment)]] **2.** `(args, namespace) -> tuple[T, list[str | MessageSegment]]` - - **参数** - - `args` (Sequence[str | [MessageSegment](adapters/index.md#MessageSegment)] | None) - `namespace` (T) - **返回** - - tuple[T, list[str | [MessageSegment](adapters/index.md#MessageSegment)]] **3.** `(*, namespace) -> tuple[T, list[str | MessageSegment]]` - - **参数** - - `namespace` (T) - **返回** - - tuple[T, list[str | [MessageSegment](adapters/index.md#MessageSegment)]] ## _class_ `ShellCommandRule(cmds, parser)` {#ShellCommandRule} @@ -269,7 +242,6 @@ description: nonebot.rule 模块 - **说明:** 检查消息是否为指定 shell 命令。 - **参数** - - `cmds` (list[tuple[str, ...]]): 指定命令元组列表 - `parser` (ArgumentParser | None): 可选参数解析器 @@ -298,13 +270,11 @@ description: nonebot.rule 模块 ::: - **参数** - - `*cmds` (str | tuple[str, ...]): 命令文本或命令元组 - `parser` (ArgumentParser | None): [ArgumentParser](#ArgumentParser) 对象 - **返回** - - [Rule](#Rule) - **用法** @@ -330,7 +300,6 @@ description: nonebot.rule 模块 - **说明:** 检查消息字符串是否符合指定正则表达式。 - **参数** - - `regex` (str): 正则表达式 - `flags` (int): 正则表达式标记 @@ -346,13 +315,11 @@ description: nonebot.rule 模块 通过 [RegexDict](params.md#RegexDict) 获取匹配成功的 group 字典。 - **参数** - - `regex` (str): 正则表达式 - `flags` (int | re.RegexFlag): 正则表达式标记 - **返回** - - [Rule](#Rule) :::tip 提示 @@ -380,7 +347,6 @@ description: nonebot.rule 模块 empty - **返回** - - [Rule](#Rule) ## _class_ `IsTypeRule(*types)` {#IsTypeRule} @@ -388,7 +354,6 @@ description: nonebot.rule 模块 - **说明:** 检查事件类型是否为指定类型。 - **参数** - - `*types` (type[[Event](adapters/index.md#Event)]) ## _def_ `is_type(*types)` {#is-type} @@ -396,9 +361,7 @@ description: nonebot.rule 模块 - **说明:** 匹配事件类型。 - **参数** - - `*types` (type[[Event](adapters/index.md#Event)]): 事件类型 - **返回** - - [Rule](#Rule) diff --git a/website/versioned_docs/version-2.4.2/api/typing.md b/website/versioned_docs/version-2.4.2/api/typing.md index 8b1c5005..8a5ea9eb 100644 --- a/website/versioned_docs/version-2.4.2/api/typing.md +++ b/website/versioned_docs/version-2.4.2/api/typing.md @@ -19,31 +19,25 @@ description: nonebot.typing 模块 - **说明:** 标记一个方法为父类 interface 的 implement - **参数** - - `InterfaceClass` (object) - **返回** - - untyped ## _def_ `type_has_args(type_)` {#type-has-args} - **参数** - - `type_` (type[Any]) - **返回** - - bool ## _def_ `origin_is_union(origin)` {#origin-is-union} - **参数** - - `origin` (type[Any] | None) - **返回** - - bool ## _def_ `origin_is_literal(origin)` {#origin-is-literal} @@ -51,11 +45,9 @@ description: nonebot.typing 模块 - **说明:** 判断是否是 Literal 类型 - **参数** - - `origin` (type[Any] | None) - **返回** - - bool ## _def_ `all_literal_values(type_)` {#all-literal-values} @@ -63,11 +55,9 @@ description: nonebot.typing 模块 - **说明:** 获取 Literal 类型包含的所有值 - **参数** - - `type_` (type[Any]) - **返回** - - list[Any] ## _def_ `origin_is_annotated(origin)` {#origin-is-annotated} @@ -75,11 +65,9 @@ description: nonebot.typing 模块 - **说明:** 判断是否是 Annotated 类型 - **参数** - - `origin` (type[Any] | None) - **返回** - - bool ## _def_ `is_none_type(type_)` {#is-none-type} @@ -87,17 +75,14 @@ description: nonebot.typing 模块 - **说明:** 判断是否是 None 类型 - **参数** - - `type_` (type[Any]) - **返回** - - bool ## _def_ `evaluate_forwardref(ref, globalns, localns)` {#evaluate-forwardref} - **参数** - - `ref` (ForwardRef) - `globalns` (dict[str, Any]) @@ -105,7 +90,6 @@ description: nonebot.typing 模块 - `localns` (dict[str, Any]) - **返回** - - Any ## _class_ `StateFlag()` {#StateFlag} @@ -129,7 +113,6 @@ description: nonebot.typing 模块 Bot 连接建立时钩子函数 依赖参数: - - DependParam: 子依赖参数 - BotParam: Bot 对象 - DefaultParam: 带有默认值的参数 @@ -143,7 +126,6 @@ description: nonebot.typing 模块 Bot 连接断开时钩子函数 依赖参数: - - DependParam: 子依赖参数 - BotParam: Bot 对象 - DefaultParam: 带有默认值的参数 @@ -169,7 +151,6 @@ description: nonebot.typing 模块 事件预处理函数 EventPreProcessor 类型 依赖参数: - - DependParam: 子依赖参数 - BotParam: Bot 对象 - EventParam: Event 对象 @@ -185,7 +166,6 @@ description: nonebot.typing 模块 事件后处理函数 EventPostProcessor 类型 依赖参数: - - DependParam: 子依赖参数 - BotParam: Bot 对象 - EventParam: Event 对象 @@ -201,7 +181,6 @@ description: nonebot.typing 模块 事件响应器运行前预处理函数 RunPreProcessor 类型 依赖参数: - - DependParam: 子依赖参数 - BotParam: Bot 对象 - EventParam: Event 对象 @@ -218,7 +197,6 @@ description: nonebot.typing 模块 事件响应器运行后后处理函数 RunPostProcessor 类型 依赖参数: - - DependParam: 子依赖参数 - BotParam: Bot 对象 - EventParam: Event 对象 @@ -236,7 +214,6 @@ description: nonebot.typing 模块 RuleChecker 即判断是否响应事件的处理函数。 依赖参数: - - DependParam: 子依赖参数 - BotParam: Bot 对象 - EventParam: Event 对象 @@ -252,7 +229,6 @@ description: nonebot.typing 模块 PermissionChecker 即判断事件是否满足权限的处理函数。 依赖参数: - - DependParam: 子依赖参数 - BotParam: Bot 对象 - EventParam: Event 对象 @@ -273,7 +249,6 @@ description: nonebot.typing 模块 TypeUpdater 在 Matcher.pause, Matcher.reject 时被运行,用于更新响应的事件类型。 默认会更新为 `message`。 依赖参数: - - DependParam: 子依赖参数 - BotParam: Bot 对象 - EventParam: Event 对象 @@ -290,7 +265,6 @@ description: nonebot.typing 模块 PermissionUpdater 在 Matcher.pause, Matcher.reject 时被运行,用于更新会话对象权限。 默认会更新为当前事件的触发对象。 依赖参数: - - DependParam: 子依赖参数 - BotParam: Bot 对象 - EventParam: Event 对象 diff --git a/website/versioned_docs/version-2.4.2/api/utils.md b/website/versioned_docs/version-2.4.2/api/utils.md index 789478d1..06187453 100644 --- a/website/versioned_docs/version-2.4.2/api/utils.md +++ b/website/versioned_docs/version-2.4.2/api/utils.md @@ -18,11 +18,9 @@ description: nonebot.utils 模块 参考: [loguru color 标签](https://loguru.readthedocs.io/en/stable/api/logger.html#color) - **参数** - - `s` (str): 需要转义的字符串 - **返回** - - str ## _def_ `deep_update(mapping, *updating_mappings)` {#deep-update} @@ -30,13 +28,11 @@ description: nonebot.utils 模块 - **说明:** 深度更新合并字典 - **参数** - - `mapping` (dict[K, Any]) - `*updating_mappings` (dict[K, Any]) - **返回** - - dict[K, Any] ## _def_ `lenient_issubclass(cls, class_or_tuple)` {#lenient-issubclass} @@ -44,13 +40,11 @@ description: nonebot.utils 模块 - **说明:** 检查 cls 是否是 class_or_tuple 中的一个类型子类并忽略类型错误。 - **参数** - - `cls` (Any) - `class_or_tuple` (type[Any] | tuple[type[Any], ...]) - **返回** - - bool ## _def_ `generic_check_issubclass(cls, class_or_tuple)` {#generic-check-issubclass} @@ -60,7 +54,6 @@ description: nonebot.utils 模块 检查 cls 是否是 class_or_tuple 中的一个类型子类。 特别的: - - 如果 cls 是 `typing.Union` 或 `types.UnionType` 类型, 则会检查其中的所有类型是否是 class_or_tuple 中一个类型的子类或 None。 - 如果 cls 是 `typing.Literal` 类型, @@ -70,13 +63,11 @@ description: nonebot.utils 模块 是否是 class_or_tuple 中一个类型的子类或 None。 - **参数** - - `cls` (Any) - `class_or_tuple` (type[Any] | tuple[type[Any], ...]) - **返回** - - bool ## _def_ `type_is_complex(type_)` {#type-is-complex} @@ -84,11 +75,9 @@ description: nonebot.utils 模块 - **说明:** 检查 type\_ 是否是复杂类型 - **参数** - - `type_` (type[Any]) - **返回** - - bool ## _def_ `is_coroutine_callable(call)` {#is-coroutine-callable} @@ -96,11 +85,9 @@ description: nonebot.utils 模块 - **说明:** 检查 call 是否是一个 callable 协程函数 - **参数** - - `call` ((...) -> Any) - **返回** - - bool ## _def_ `is_gen_callable(call)` {#is-gen-callable} @@ -108,11 +95,9 @@ description: nonebot.utils 模块 - **说明:** 检查 call 是否是一个生成器函数 - **参数** - - `call` ((...) -> Any) - **返回** - - bool ## _def_ `is_async_gen_callable(call)` {#is-async-gen-callable} @@ -120,11 +105,9 @@ description: nonebot.utils 模块 - **说明:** 检查 call 是否是一个异步生成器函数 - **参数** - - `call` ((...) -> Any) - **返回** - - bool ## _def_ `run_sync(call)` {#run-sync} @@ -132,11 +115,9 @@ description: nonebot.utils 模块 - **说明:** 一个用于包装 sync function 为 async function 的装饰器 - **参数** - - `call` ((P) -> R): 被装饰的同步函数 - **返回** - - (P) -> Coroutine[None, None, R] ## _def_ `run_sync_ctx_manager(cm)` {#run-sync-ctx-manager} @@ -144,11 +125,9 @@ description: nonebot.utils 模块 - **说明:** 一个用于包装 sync context manager 为 async context manager 的执行函数 - **参数** - - `cm` (AbstractContextManager[T]) - **返回** - - AsyncGenerator[T, None] ## _async def_ `run_coro_with_catch(coro, exc, return_on_err=None)` {#run-coro-with-catch} @@ -158,9 +137,7 @@ description: nonebot.utils 模块 - **重载** **1.** `(coro, exc, return_on_err=None) -> T | None` - - **参数** - - `coro` (Coroutine[Any, Any, T]) - `exc` (tuple[type[Exception], ...]) @@ -168,13 +145,10 @@ description: nonebot.utils 模块 - `return_on_err` (None) - **返回** - - T | None **2.** `(coro, exc, return_on_err) -> T | R` - - **参数** - - `coro` (Coroutine[Any, Any, T]) - `exc` (tuple[type[Exception], ...]) @@ -182,11 +156,9 @@ description: nonebot.utils 模块 - `return_on_err` (R) - **返回** - - T | R - **参数** - - `coro`: 要运行的协程 - `exc`: 要捕获的异常 @@ -202,21 +174,17 @@ description: nonebot.utils 模块 - **说明:** 运行协程并在取消时屏蔽取消异常。 - **参数** - - `coro` (Coroutine[Any, Any, T]): 要运行的协程 - **返回** - - T: 协程的返回值 ## _def_ `flatten_exception_group(exc_group)` {#flatten-exception-group} - **参数** - - `exc_group` (BaseExceptionGroup[E]) - **返回** - - Generator[E, None, None] ## _def_ `get_name(obj)` {#get-name} @@ -224,11 +192,9 @@ description: nonebot.utils 模块 - **说明:** 获取对象的名称 - **参数** - - `obj` (Any) - **返回** - - str ## _def_ `path_to_module_name(path)` {#path-to-module-name} @@ -236,11 +202,9 @@ description: nonebot.utils 模块 - **说明:** 转换路径为模块名 - **参数** - - `path` (Path) - **返回** - - str ## _def_ `resolve_dot_notation(obj_str, default_attr, default_prefix=None)` {#resolve-dot-notation} @@ -248,7 +212,6 @@ description: nonebot.utils 模块 - **说明:** 解析并导入点分表示法的对象 - **参数** - - `obj_str` (str) - `default_attr` (str) @@ -256,7 +219,6 @@ description: nonebot.utils 模块 - `default_prefix` (str | None) - **返回** - - Any ## _class_ `classproperty(func)` {#classproperty} @@ -264,7 +226,6 @@ description: nonebot.utils 模块 - **说明:** 类属性装饰器 - **参数** - - `func` ((Any) -> T) ## _class_ `DataclassEncoder()` {#DataclassEncoder} @@ -278,11 +239,9 @@ description: nonebot.utils 模块 ### _method_ `default(o)` {#DataclassEncoder-default} - **参数** - - `o` - **返回** - - untyped ## _def_ `logger_wrapper(logger_name)` {#logger-wrapper} @@ -290,15 +249,12 @@ description: nonebot.utils 模块 - **说明:** 用于打印 adapter 的日志。 - **参数** - - `logger_name` (str): adapter 的名称 - **返回** - - untyped: 日志记录函数 日志记录函数的参数: - - level: 日志等级 - message: 日志信息 - exception: 异常信息 diff --git a/website/versioned_docs/version-2.4.2/best-practice/alconna/command.md b/website/versioned_docs/version-2.4.2/best-practice/alconna/command.md index e5df7cbd..65a97131 100644 --- a/website/versioned_docs/version-2.4.2/best-practice/alconna/command.md +++ b/website/versioned_docs/version-2.4.2/best-practice/alconna/command.md @@ -278,7 +278,6 @@ opt2 = Option("--foo", default=OptionResult(value=False, args={"bar": 1})) `Arparma` 有如下属性: - 调试类 - - matched: 是否匹配成功 - error_data: 解析失败时剩余的数据 - error_info: 解析失败时的异常内容 diff --git a/website/versioned_docs/version-2.4.2/best-practice/testing/behavior.mdx b/website/versioned_docs/version-2.4.2/best-practice/testing/behavior.mdx index 3203d8a8..37d55c13 100644 --- a/website/versioned_docs/version-2.4.2/best-practice/testing/behavior.mdx +++ b/website/versioned_docs/version-2.4.2/best-practice/testing/behavior.mdx @@ -155,7 +155,6 @@ async def test_example(app: App): 1. `should_call_send` 定义事件响应器预期发送的消息,即通过[事件响应器操作 send](../../appendices/session-control.mdx#send)进行的操作。`should_call_send` 有四个参数: - - `event`:回复的目标事件。 - `message`:预期的消息对象,可以是 `str`、`Message` 或 `MessageSegment`。 - `result`:send 的返回值,将会返回给插件。 @@ -164,7 +163,6 @@ async def test_example(app: App): 2. `should_call_api` 定义事件响应器预期调用的平台 API 接口,即通过[调用平台 API](../../appendices/api-calling.mdx#调用平台-api)进行的操作。`should_call_api` 有四个参数: - - `api`:API 名称。 - `data`:预期的请求数据。 - `result`:call_api 的返回值,将会返回给插件。 diff --git a/website/versioned_docs/version-2.4.3/api/adapters/index.md b/website/versioned_docs/version-2.4.3/api/adapters/index.md index 920b6c93..7cc8cd71 100644 --- a/website/versioned_docs/version-2.4.3/api/adapters/index.md +++ b/website/versioned_docs/version-2.4.3/api/adapters/index.md @@ -20,7 +20,6 @@ description: nonebot.adapters 模块 通常,在 Adapter 中编写协议通信相关代码,如: 建立通信连接、处理接收与发送 data 等。 - **参数** - - `driver` ([Driver](../drivers/index.md#Driver)): [Driver](../drivers/index.md#Driver) 实例 - `**kwargs` (Any): 其他由 [Driver.register_adapter](../drivers/index.md#Driver-register-adapter) 传入的额外参数 @@ -46,7 +45,6 @@ description: nonebot.adapters 模块 empty - **返回** - - str ### _property_ `config` {#Adapter-config} @@ -64,11 +62,9 @@ description: nonebot.adapters 模块 当有新的 [Bot](#Bot) 实例连接建立成功时调用。 - **参数** - - `bot` ([Bot](#Bot)): [Bot](#Bot) 实例 - **返回** - - None ### _method_ `bot_disconnect(bot)` {#Adapter-bot-disconnect} @@ -80,11 +76,9 @@ description: nonebot.adapters 模块 当有 [Bot](#Bot) 实例连接断开时调用。 - **参数** - - `bot` ([Bot](#Bot)): [Bot](#Bot) 实例 - **返回** - - None ### _method_ `setup_http_server(setup)` {#Adapter-setup-http-server} @@ -92,11 +86,9 @@ description: nonebot.adapters 模块 - **说明:** 设置一个 HTTP 服务器路由配置 - **参数** - - `setup` ([HTTPServerSetup](../drivers/index.md#HTTPServerSetup)) - **返回** - - untyped ### _method_ `setup_websocket_server(setup)` {#Adapter-setup-websocket-server} @@ -104,11 +96,9 @@ description: nonebot.adapters 模块 - **说明:** 设置一个 WebSocket 服务器路由配置 - **参数** - - `setup` ([WebSocketServerSetup](../drivers/index.md#WebSocketServerSetup)) - **返回** - - untyped ### _async method_ `request(setup)` {#Adapter-request} @@ -116,11 +106,9 @@ description: nonebot.adapters 模块 - **说明:** 进行一个 HTTP 客户端请求 - **参数** - - `setup` ([Request](../drivers/index.md#Request)) - **返回** - - [Response](../drivers/index.md#Response) ### _method_ `websocket(setup)` {#Adapter-websocket} @@ -128,21 +116,17 @@ description: nonebot.adapters 模块 - **说明:** 建立一个 WebSocket 客户端连接请求 - **参数** - - `setup` ([Request](../drivers/index.md#Request)) - **返回** - - AsyncGenerator[[WebSocket](../drivers/index.md#WebSocket), None] ### _method_ `on_ready(func)` {#Adapter-on-ready} - **参数** - - `func` (LIFESPAN_FUNC) - **返回** - - LIFESPAN_FUNC ## _abstract class_ `Bot(adapter, self_id)` {#Bot} @@ -154,7 +138,6 @@ description: nonebot.adapters 模块 用于处理上报消息,并提供 API 调用接口。 - **参数** - - `adapter` ([Adapter](#Adapter)): 协议适配器实例 - `self_id` (str): 机器人 ID @@ -188,13 +171,11 @@ description: nonebot.adapters 模块 - **说明:** 调用机器人 API 接口,可以通过该函数或直接通过 bot 属性进行调用 - **参数** - - `api` (str): API 名称 - `**data` (Any): API 数据 - **返回** - - Any - **用法** @@ -209,7 +190,6 @@ description: nonebot.adapters 模块 - **说明:** 调用机器人基础发送消息接口 - **参数** - - `event` ([Event](#Event)): 上报事件 - `message` (str | [Message](#Message) | [MessageSegment](#MessageSegment)): 要发送的消息 @@ -217,7 +197,6 @@ description: nonebot.adapters 模块 - `**kwargs` (Any): 任意额外参数 - **返回** - - Any ### _classmethod_ `on_calling_api(func)` {#Bot-on-calling-api} @@ -227,17 +206,14 @@ description: nonebot.adapters 模块 调用 api 预处理。 钩子函数参数: - - bot: 当前 bot 对象 - api: 调用的 api 名称 - data: api 调用的参数字典 - **参数** - - `func` ([T_CallingAPIHook](../typing.md#T-CallingAPIHook)) - **返回** - - [T_CallingAPIHook](../typing.md#T-CallingAPIHook) ### _classmethod_ `on_called_api(func)` {#Bot-on-called-api} @@ -247,7 +223,6 @@ description: nonebot.adapters 模块 调用 api 后处理。 钩子函数参数: - - bot: 当前 bot 对象 - exception: 调用 api 时发生的错误 - api: 调用的 api 名称 @@ -255,11 +230,9 @@ description: nonebot.adapters 模块 - result: api 调用的返回 - **参数** - - `func` ([T_CalledAPIHook](../typing.md#T-CalledAPIHook)) - **返回** - - [T_CalledAPIHook](../typing.md#T-CalledAPIHook) ## _abstract class_ `Event()` {#Event} @@ -279,7 +252,6 @@ description: nonebot.adapters 模块 empty - **返回** - - str ### _abstract method_ `get_event_name()` {#Event-get-event-name} @@ -291,7 +263,6 @@ description: nonebot.adapters 模块 empty - **返回** - - str ### _abstract method_ `get_event_description()` {#Event-get-event-description} @@ -303,7 +274,6 @@ description: nonebot.adapters 模块 empty - **返回** - - str ### _method_ `get_log_string()` {#Event-get-log-string} @@ -320,11 +290,9 @@ description: nonebot.adapters 模块 empty - **返回** - - str - **异常** - - NoLogException: 希望 NoneBot 隐藏该事件日志 ### _abstract method_ `get_user_id()` {#Event-get-user-id} @@ -336,7 +304,6 @@ description: nonebot.adapters 模块 empty - **返回** - - str ### _abstract method_ `get_session_id()` {#Event-get-session-id} @@ -348,7 +315,6 @@ description: nonebot.adapters 模块 empty - **返回** - - str ### _abstract method_ `get_message()` {#Event-get-message} @@ -360,7 +326,6 @@ description: nonebot.adapters 模块 empty - **返回** - - [Message](#Message) ### _method_ `get_plaintext()` {#Event-get-plaintext} @@ -376,7 +341,6 @@ description: nonebot.adapters 模块 empty - **返回** - - str ### _abstract method_ `is_tome()` {#Event-is-tome} @@ -388,7 +352,6 @@ description: nonebot.adapters 模块 empty - **返回** - - bool ## _abstract class_ `Message()` {#Message} @@ -396,7 +359,6 @@ description: nonebot.adapters 模块 - **说明:** 消息序列 - **参数** - - `message`: 消息内容 ### _classmethod_ `template(format_string)` {#Message-template} @@ -410,11 +372,9 @@ description: nonebot.adapters 模块 可以通过该消息类型的 `MessageSegment` 工厂方法创建消息。 - **参数** - - `format_string` (str | TM): 格式化模板 - **返回** - - [MessageTemplate](#MessageTemplate)[Self]: 消息格式化器 ### _abstract classmethod_ `get_segment_class()` {#Message-get-segment-class} @@ -426,7 +386,6 @@ description: nonebot.adapters 模块 empty - **返回** - - type[TMS] ### _abstract staticmethod_ `_construct(msg)` {#Message--construct} @@ -434,11 +393,9 @@ description: nonebot.adapters 模块 - **说明:** 构造消息数组 - **参数** - - `msg` (str) - **返回** - - Iterable[TMS] ### _method_ `__getitem__(args)` {#Message---getitem--} @@ -446,53 +403,38 @@ description: nonebot.adapters 模块 - **重载** **1.** `(args) -> Self` - - **参数** - - `args` (str): 消息段类型 - **返回** - - Self: 所有类型为 `args` 的消息段 **2.** `(args) -> TMS` - - **参数** - - `args` (tuple[str, int]): 消息段类型和索引 - **返回** - - TMS: 类型为 `args[0]` 的消息段第 `args[1]` 个 **3.** `(args) -> Self` - - **参数** - - `args` (tuple[str, slice]): 消息段类型和切片 - **返回** - - Self: 类型为 `args[0]` 的消息段切片 `args[1]` **4.** `(args) -> TMS` - - **参数** - - `args` (int): 索引 - **返回** - - TMS: 第 `args` 个消息段 **5.** `(args) -> Self` - - **参数** - - `args` (slice): 切片 - **返回** - - Self: 消息切片 `args` ### _method_ `__contains__(value)` {#Message---contains--} @@ -500,11 +442,9 @@ description: nonebot.adapters 模块 - **说明:** 检查消息段是否存在 - **参数** - - `value` (TMS | str): 消息段或消息段类型 - **返回** - - bool: 消息内是否存在给定消息段或给定类型的消息段 ### _method_ `has(value)` {#Message-has} @@ -512,11 +452,9 @@ description: nonebot.adapters 模块 - **说明:** 与 [`__contains__`](#Message---contains--) 相同 - **参数** - - `value` (TMS | str) - **返回** - - bool ### _method_ `index(value, *args)` {#Message-index} @@ -524,7 +462,6 @@ description: nonebot.adapters 模块 - **说明:** 索引消息段 - **参数** - - `value` (TMS | str): 消息段或者消息段类型 - `*args` (SupportsIndex) @@ -532,11 +469,9 @@ description: nonebot.adapters 模块 - `arg`: start 与 end - **返回** - - int: 索引 index - **异常** - - ValueError: 消息段不存在 ### _method_ `get(type_, count=None)` {#Message-get} @@ -544,13 +479,11 @@ description: nonebot.adapters 模块 - **说明:** 获取指定类型的消息段 - **参数** - - `type_` (str): 消息段类型 - `count` (int | None): 获取个数 - **返回** - - Self: 构建的新消息 ### _method_ `count(value)` {#Message-count} @@ -558,11 +491,9 @@ description: nonebot.adapters 模块 - **说明:** 计算指定消息段的个数 - **参数** - - `value` (TMS | str): 消息段或消息段类型 - **返回** - - int: 个数 ### _method_ `only(value)` {#Message-only} @@ -570,11 +501,9 @@ description: nonebot.adapters 模块 - **说明:** 检查消息中是否仅包含指定消息段 - **参数** - - `value` (TMS | str): 指定消息段或消息段类型 - **返回** - - bool: 是否仅包含指定消息段 ### _method_ `append(obj)` {#Message-append} @@ -582,11 +511,9 @@ description: nonebot.adapters 模块 - **说明:** 添加一个消息段到消息数组末尾。 - **参数** - - `obj` (str | TMS): 要添加的消息段 - **返回** - - Self ### _method_ `extend(obj)` {#Message-extend} @@ -594,11 +521,9 @@ description: nonebot.adapters 模块 - **说明:** 拼接一个消息数组或多个消息段到消息数组末尾。 - **参数** - - `obj` (Self | Iterable[TMS]): 要添加的消息数组 - **返回** - - Self ### _method_ `join(iterable)` {#Message-join} @@ -606,11 +531,9 @@ description: nonebot.adapters 模块 - **说明:** 将多个消息连接并将自身作为分割 - **参数** - - `iterable` (Iterable[TMS | Self]): 要连接的消息 - **返回** - - Self: 连接后的消息 ### _method_ `copy()` {#Message-copy} @@ -622,7 +545,6 @@ description: nonebot.adapters 模块 empty - **返回** - - Self ### _method_ `include(*types)` {#Message-include} @@ -630,11 +552,9 @@ description: nonebot.adapters 模块 - **说明:** 过滤消息 - **参数** - - `*types` (str): 包含的消息段类型 - **返回** - - Self: 新构造的消息 ### _method_ `exclude(*types)` {#Message-exclude} @@ -642,11 +562,9 @@ description: nonebot.adapters 模块 - **说明:** 过滤消息 - **参数** - - `*types` (str): 不包含的消息段类型 - **返回** - - Self: 新构造的消息 ### _method_ `extract_plain_text()` {#Message-extract-plain-text} @@ -658,7 +576,6 @@ description: nonebot.adapters 模块 empty - **返回** - - str ## _abstract class_ `MessageSegment()` {#MessageSegment} @@ -690,7 +607,6 @@ description: nonebot.adapters 模块 empty - **返回** - - type[TM] ### _abstract method_ `__str__()` {#MessageSegment---str--} @@ -702,29 +618,24 @@ description: nonebot.adapters 模块 empty - **返回** - - str ### _method_ `__add__(other)` {#MessageSegment---add--} - **参数** - - `other` (str | Self | Iterable[Self]) - **返回** - - TM ### _method_ `get(key, default=None)` {#MessageSegment-get} - **参数** - - `key` (str) - `default` (Any) - **返回** - - untyped ### _method_ `keys()` {#MessageSegment-keys} @@ -734,7 +645,6 @@ description: nonebot.adapters 模块 empty - **返回** - - untyped ### _method_ `values()` {#MessageSegment-values} @@ -744,7 +654,6 @@ description: nonebot.adapters 模块 empty - **返回** - - untyped ### _method_ `items()` {#MessageSegment-items} @@ -754,17 +663,14 @@ description: nonebot.adapters 模块 empty - **返回** - - untyped ### _method_ `join(iterable)` {#MessageSegment-join} - **参数** - - `iterable` (Iterable[Self | TM]) - **返回** - - TM ### _method_ `copy()` {#MessageSegment-copy} @@ -774,7 +680,6 @@ description: nonebot.adapters 模块 empty - **返回** - - Self ### _abstract method_ `is_text()` {#MessageSegment-is-text} @@ -786,7 +691,6 @@ description: nonebot.adapters 模块 empty - **返回** - - bool ## _class_ `MessageTemplate(template, factory=str, private_getattr=False)` {#MessageTemplate} @@ -794,7 +698,6 @@ description: nonebot.adapters 模块 - **说明:** 消息模板格式化实现类。 - **参数** - - `template` (str | TM): 模板 - `factory` (type[str] | type[TM]): 消息类型工厂,默认为 `str` @@ -804,13 +707,11 @@ description: nonebot.adapters 模块 ### _method_ `add_format_spec(spec, name=None)` {#MessageTemplate-add-format-spec} - **参数** - - `spec` (FormatSpecFunc_T) - `name` (str | None) - **返回** - - FormatSpecFunc_T ### _method_ `format(*args, **kwargs)` {#MessageTemplate-format} @@ -818,13 +719,11 @@ description: nonebot.adapters 模块 - **说明:** 根据传入参数和模板生成消息对象 - **参数** - - `*args` - `**kwargs` - **返回** - - TF ### _method_ `format_map(mapping)` {#MessageTemplate-format-map} @@ -832,17 +731,14 @@ description: nonebot.adapters 模块 - **说明:** 根据传入字典和模板生成消息对象, 在传入字段名不是有效标识符时有用 - **参数** - - `mapping` (Mapping[str, Any]) - **返回** - - TF ### _method_ `vformat(format_string, args, kwargs)` {#MessageTemplate-vformat} - **参数** - - `format_string` (str) - `args` (Sequence[Any]) @@ -850,13 +746,11 @@ description: nonebot.adapters 模块 - `kwargs` (Mapping[str, Any]) - **返回** - - TF ### _method_ `get_field(field_name, args, kwargs)` {#MessageTemplate-get-field} - **参数** - - `field_name` (str) - `args` (Sequence[Any]) @@ -864,17 +758,14 @@ description: nonebot.adapters 模块 - `kwargs` (Mapping[str, Any]) - **返回** - - tuple[Any, int | str] ### _method_ `format_field(value, format_spec)` {#MessageTemplate-format-field} - **参数** - - `value` (Any) - `format_spec` (str) - **返回** - - Any diff --git a/website/versioned_docs/version-2.4.3/api/compat.md b/website/versioned_docs/version-2.4.3/api/compat.md index e4f9da20..b497b6f4 100644 --- a/website/versioned_docs/version-2.4.3/api/compat.md +++ b/website/versioned_docs/version-2.4.3/api/compat.md @@ -36,7 +36,6 @@ description: nonebot.compat 模块 - **说明:** FieldInfo class with extra property for compatibility with pydantic v1 - **参数** - - `default` (Any) - `**kwargs` (Any) @@ -82,7 +81,6 @@ description: nonebot.compat 模块 - **说明:** Construct a ModelField from given infos. - **参数** - - `name` (str) - `annotation` (Any) @@ -90,7 +88,6 @@ description: nonebot.compat 模块 - `field_info` (FieldInfo | None) - **返回** - - Self ### _method_ `get_default()` {#ModelField-get-default} @@ -102,7 +99,6 @@ description: nonebot.compat 模块 empty - **返回** - - Any ### _method_ `validate_value(value)` {#ModelField-validate-value} @@ -110,11 +106,9 @@ description: nonebot.compat 模块 - **说明:** Validate the value pass to the field. - **参数** - - `value` (Any) - **返回** - - Any ## _def_ `extract_field_info(field_info)` {#extract-field-info} @@ -122,11 +116,9 @@ description: nonebot.compat 模块 - **说明:** Get FieldInfo init kwargs from a FieldInfo instance. - **参数** - - `field_info` (BaseFieldInfo) - **返回** - - dict[str, Any] ## _def_ `model_fields(model)` {#model-fields} @@ -134,11 +126,9 @@ description: nonebot.compat 模块 - **说明:** Get field list of a model. - **参数** - - `model` (type[BaseModel]) - **返回** - - list[ModelField] ## _def_ `model_config(model)` {#model-config} @@ -146,17 +136,14 @@ description: nonebot.compat 模块 - **说明:** Get config of a model. - **参数** - - `model` (type[BaseModel]) - **返回** - - Any ## _def_ `model_dump(model, include=None, exclude=None, by_alias=False, exclude_unset=False, exclude_defaults=False, exclude_none=False)` {#model-dump} - **参数** - - `model` (BaseModel) - `include` (set[str] | None) @@ -172,7 +159,6 @@ description: nonebot.compat 模块 - `exclude_none` (bool) - **返回** - - dict[str, Any] ## _def_ `type_validate_python(type_, data)` {#type-validate-python} @@ -180,13 +166,11 @@ description: nonebot.compat 模块 - **说明:** Validate data with given type. - **参数** - - `type_` (type[T]) - `data` (Any) - **返回** - - T ## _def_ `type_validate_json(type_, data)` {#type-validate-json} @@ -194,13 +178,11 @@ description: nonebot.compat 模块 - **说明:** Validate JSON with given type. - **参数** - - `type_` (type[T]) - `data` (str | bytes) - **返回** - - T ## _def_ `custom_validation(class_)` {#custom-validation} @@ -208,9 +190,7 @@ description: nonebot.compat 模块 - **说明:** Use pydantic v1 like validator generator in pydantic v2 - **参数** - - `class_` (type[CVC]) - **返回** - - type[CVC] diff --git a/website/versioned_docs/version-2.4.3/api/config.md b/website/versioned_docs/version-2.4.3/api/config.md index 847404fd..6bf23ee8 100644 --- a/website/versioned_docs/version-2.4.3/api/config.md +++ b/website/versioned_docs/version-2.4.3/api/config.md @@ -24,7 +24,6 @@ NoneBot 使用 [`pydantic`](https://pydantic-docs.helpmanual.io/) 以及 将会从 **环境变量** > **dotenv 配置文件** 的优先级读取环境信息。 - **参数** - - `_env_file` (DOTENV_TYPE | None) - `_env_file_encoding` (str | None) @@ -55,7 +54,6 @@ NoneBot 使用 [`pydantic`](https://pydantic-docs.helpmanual.io/) 以及 配置方法参考: [配置](https://nonebot.dev/docs/appendices/config) - **参数** - - `_env_file` (DOTENV_TYPE | None) - `_env_file_encoding` (str | None) diff --git a/website/versioned_docs/version-2.4.3/api/dependencies/index.md b/website/versioned_docs/version-2.4.3/api/dependencies/index.md index c11b6e8c..74732936 100644 --- a/website/versioned_docs/version-2.4.3/api/dependencies/index.md +++ b/website/versioned_docs/version-2.4.3/api/dependencies/index.md @@ -18,7 +18,6 @@ description: nonebot.dependencies 模块 继承自 `pydantic.fields.FieldInfo`,用于描述参数信息(不包括参数名)。 - **参数** - - `*args` - `validate` (bool) @@ -30,7 +29,6 @@ description: nonebot.dependencies 模块 - **说明:** 依赖注入容器 - **参数** - - `call`: 依赖注入的可调用对象,可以是任何 Callable 对象 - `pre_checkers`: 依赖注入解析前的参数检查 @@ -44,31 +42,26 @@ description: nonebot.dependencies 模块 ### _staticmethod_ `parse_params(call, allow_types)` {#Dependent-parse-params} - **参数** - - `call` (\_DependentCallable[R]) - `allow_types` (tuple[type[Param], ...]) - **返回** - - tuple[[ModelField](../compat.md#ModelField), ...] ### _staticmethod_ `parse_parameterless(parameterless, allow_types)` {#Dependent-parse-parameterless} - **参数** - - `parameterless` (tuple[Any, ...]) - `allow_types` (tuple[type[Param], ...]) - **返回** - - tuple[Param, ...] ### _classmethod_ `parse(*, call, parameterless=None, allow_types)` {#Dependent-parse} - **参数** - - `call` (\_DependentCallable[R]) - `parameterless` (Iterable[Any] | None) @@ -76,25 +69,20 @@ description: nonebot.dependencies 模块 - `allow_types` (Iterable[type[Param]]) - **返回** - - Dependent[R] ### _async method_ `check(**params)` {#Dependent-check} - **参数** - - `**params` (Any) - **返回** - - None ### _async method_ `solve(**params)` {#Dependent-solve} - **参数** - - `**params` (Any) - **返回** - - dict[str, Any] diff --git a/website/versioned_docs/version-2.4.3/api/dependencies/utils.md b/website/versioned_docs/version-2.4.3/api/dependencies/utils.md index 10c4fd74..2b19f9c5 100644 --- a/website/versioned_docs/version-2.4.3/api/dependencies/utils.md +++ b/website/versioned_docs/version-2.4.3/api/dependencies/utils.md @@ -12,11 +12,9 @@ description: nonebot.dependencies.utils 模块 - **说明:** 获取可调用对象签名 - **参数** - - `call` ((...) -> Any) - **返回** - - inspect.Signature ## _def_ `get_typed_annotation(param, globalns)` {#get-typed-annotation} @@ -24,13 +22,11 @@ description: nonebot.dependencies.utils 模块 - **说明:** 获取参数的类型注解 - **参数** - - `param` (inspect.Parameter) - `globalns` (dict[str, Any]) - **返回** - - Any ## _def_ `check_field_type(field, value)` {#check-field-type} @@ -38,11 +34,9 @@ description: nonebot.dependencies.utils 模块 - **说明:** 检查字段类型是否匹配 - **参数** - - `field` ([ModelField](../compat.md#ModelField)) - `value` (Any) - **返回** - - Any diff --git a/website/versioned_docs/version-2.4.3/api/drivers/aiohttp.md b/website/versioned_docs/version-2.4.3/api/drivers/aiohttp.md index 7434b941..4e6a44be 100644 --- a/website/versioned_docs/version-2.4.3/api/drivers/aiohttp.md +++ b/website/versioned_docs/version-2.4.3/api/drivers/aiohttp.md @@ -22,7 +22,6 @@ pip install nonebot2[aiohttp] ## _class_ `Session(params=None, headers=None, cookies=None, version=HTTPVersion.H11, timeout=None, proxy=None)` {#Session} - **参数** - - `params` (QueryTypes) - `headers` (HeaderTypes) @@ -38,23 +37,19 @@ pip install nonebot2[aiohttp] ### _async method_ `request(setup)` {#Session-request} - **参数** - - `setup` ([Request](index.md#Request)) - **返回** - - [Response](index.md#Response) ### _method_ `stream_request(setup, *, chunk_size=1024)` {#Session-stream-request} - **参数** - - `setup` ([Request](index.md#Request)) - `chunk_size` (int) - **返回** - - AsyncGenerator[[Response](index.md#Response), None] ### _async method_ `setup()` {#Session-setup} @@ -64,7 +59,6 @@ pip install nonebot2[aiohttp] empty - **返回** - - None ### _async method_ `close()` {#Session-close} @@ -74,7 +68,6 @@ pip install nonebot2[aiohttp] empty - **返回** - - None ## _class_ `Mixin()` {#Mixin} @@ -88,39 +81,32 @@ pip install nonebot2[aiohttp] ### _async method_ `request(setup)` {#Mixin-request} - **参数** - - `setup` ([Request](index.md#Request)) - **返回** - - [Response](index.md#Response) ### _method_ `stream_request(setup, *, chunk_size=1024)` {#Mixin-stream-request} - **参数** - - `setup` ([Request](index.md#Request)) - `chunk_size` (int) - **返回** - - AsyncGenerator[[Response](index.md#Response), None] ### _method_ `websocket(setup)` {#Mixin-websocket} - **参数** - - `setup` ([Request](index.md#Request)) - **返回** - - AsyncGenerator[[WebSocket](index.md#WebSocket), None] ### _method_ `get_session(params=None, headers=None, cookies=None, version=HTTPVersion.H11, timeout=None, proxy=None)` {#Mixin-get-session} - **参数** - - `params` (QueryTypes) - `headers` (HeaderTypes) @@ -134,7 +120,6 @@ pip install nonebot2[aiohttp] - `proxy` (str | None) - **返回** - - Session ## _class_ `WebSocket(*, request, session, websocket)` {#WebSocket} @@ -142,7 +127,6 @@ pip install nonebot2[aiohttp] - **说明:** AIOHTTP Websocket Wrapper - **参数** - - `request` ([Request](index.md#Request)) - `session` (aiohttp.ClientSession) @@ -156,19 +140,16 @@ pip install nonebot2[aiohttp] empty - **返回** - - untyped ### _async method_ `close(code=1000, reason="")` {#WebSocket-close} - **参数** - - `code` (int) - `reason` (str) - **返回** - - untyped ### _async method_ `receive()` {#WebSocket-receive} @@ -178,7 +159,6 @@ pip install nonebot2[aiohttp] empty - **返回** - - str ### _async method_ `receive_text()` {#WebSocket-receive-text} @@ -188,7 +168,6 @@ pip install nonebot2[aiohttp] empty - **返回** - - str ### _async method_ `receive_bytes()` {#WebSocket-receive-bytes} @@ -198,33 +177,27 @@ pip install nonebot2[aiohttp] empty - **返回** - - bytes ### _async method_ `send_text(data)` {#WebSocket-send-text} - **参数** - - `data` (str) - **返回** - - None ### _async method_ `send_bytes(data)` {#WebSocket-send-bytes} - **参数** - - `data` (bytes) - **返回** - - None ## _class_ `Driver(env, config)` {#Driver} - **参数** - - `env` ([Env](../config.md#Env)) - `config` ([Config](../config.md#Config)) diff --git a/website/versioned_docs/version-2.4.3/api/drivers/fastapi.md b/website/versioned_docs/version-2.4.3/api/drivers/fastapi.md index bc7da389..0e80894e 100644 --- a/website/versioned_docs/version-2.4.3/api/drivers/fastapi.md +++ b/website/versioned_docs/version-2.4.3/api/drivers/fastapi.md @@ -92,7 +92,6 @@ pip install nonebot2[fastapi] - **说明:** FastAPI 驱动框架。 - **参数** - - `env` ([Env](../config.md#Env)) - `config` (NoneBotConfig) @@ -124,21 +123,17 @@ pip install nonebot2[fastapi] ### _method_ `setup_http_server(setup)` {#Driver-setup-http-server} - **参数** - - `setup` ([HTTPServerSetup](index.md#HTTPServerSetup)) - **返回** - - untyped ### _method_ `setup_websocket_server(setup)` {#Driver-setup-websocket-server} - **参数** - - `setup` ([WebSocketServerSetup](index.md#WebSocketServerSetup)) - **返回** - - None ### _method_ `run(host=None, port=None, *args, app=None, **kwargs)` {#Driver-run} @@ -146,7 +141,6 @@ pip install nonebot2[fastapi] - **说明:** 使用 `uvicorn` 启动 FastAPI - **参数** - - `host` (str | None) - `port` (int | None) @@ -158,7 +152,6 @@ pip install nonebot2[fastapi] - `**kwargs` - **返回** - - untyped ## _class_ `FastAPIWebSocket(*, request, websocket)` {#FastAPIWebSocket} @@ -166,7 +159,6 @@ pip install nonebot2[fastapi] - **说明:** FastAPI WebSocket Wrapper - **参数** - - `request` (BaseRequest) - `websocket` ([WebSocket](index.md#WebSocket)) @@ -178,19 +170,16 @@ pip install nonebot2[fastapi] empty - **返回** - - None ### _async method_ `close(code=status.WS_1000_NORMAL_CLOSURE, reason="")` {#FastAPIWebSocket-close} - **参数** - - `code` (int) - `reason` (str) - **返回** - - None ### _async method_ `receive()` {#FastAPIWebSocket-receive} @@ -200,7 +189,6 @@ pip install nonebot2[fastapi] empty - **返回** - - str | bytes ### _async method_ `receive_text()` {#FastAPIWebSocket-receive-text} @@ -210,7 +198,6 @@ pip install nonebot2[fastapi] empty - **返回** - - str ### _async method_ `receive_bytes()` {#FastAPIWebSocket-receive-bytes} @@ -220,25 +207,20 @@ pip install nonebot2[fastapi] empty - **返回** - - bytes ### _async method_ `send_text(data)` {#FastAPIWebSocket-send-text} - **参数** - - `data` (str) - **返回** - - None ### _async method_ `send_bytes(data)` {#FastAPIWebSocket-send-bytes} - **参数** - - `data` (bytes) - **返回** - - None diff --git a/website/versioned_docs/version-2.4.3/api/drivers/httpx.md b/website/versioned_docs/version-2.4.3/api/drivers/httpx.md index 2dd95bae..b959ff13 100644 --- a/website/versioned_docs/version-2.4.3/api/drivers/httpx.md +++ b/website/versioned_docs/version-2.4.3/api/drivers/httpx.md @@ -22,7 +22,6 @@ pip install nonebot2[httpx] ## _class_ `Session(params=None, headers=None, cookies=None, version=HTTPVersion.H11, timeout=None, proxy=None)` {#Session} - **参数** - - `params` (QueryTypes) - `headers` (HeaderTypes) @@ -38,23 +37,19 @@ pip install nonebot2[httpx] ### _async method_ `request(setup)` {#Session-request} - **参数** - - `setup` ([Request](index.md#Request)) - **返回** - - [Response](index.md#Response) ### _method_ `stream_request(setup, *, chunk_size=1024)` {#Session-stream-request} - **参数** - - `setup` ([Request](index.md#Request)) - `chunk_size` (int) - **返回** - - AsyncGenerator[[Response](index.md#Response), None] ### _async method_ `setup()` {#Session-setup} @@ -64,7 +59,6 @@ pip install nonebot2[httpx] empty - **返回** - - None ### _async method_ `close()` {#Session-close} @@ -74,7 +68,6 @@ pip install nonebot2[httpx] empty - **返回** - - None ## _class_ `Mixin()` {#Mixin} @@ -88,29 +81,24 @@ pip install nonebot2[httpx] ### _async method_ `request(setup)` {#Mixin-request} - **参数** - - `setup` ([Request](index.md#Request)) - **返回** - - [Response](index.md#Response) ### _method_ `stream_request(setup, *, chunk_size=1024)` {#Mixin-stream-request} - **参数** - - `setup` ([Request](index.md#Request)) - `chunk_size` (int) - **返回** - - AsyncGenerator[[Response](index.md#Response), None] ### _method_ `get_session(params=None, headers=None, cookies=None, version=HTTPVersion.H11, timeout=None, proxy=None)` {#Mixin-get-session} - **参数** - - `params` (QueryTypes) - `headers` (HeaderTypes) @@ -124,13 +112,11 @@ pip install nonebot2[httpx] - `proxy` (str | None) - **返回** - - Session ## _class_ `Driver(env, config)` {#Driver} - **参数** - - `env` ([Env](../config.md#Env)) - `config` ([Config](../config.md#Config)) diff --git a/website/versioned_docs/version-2.4.3/api/drivers/index.md b/website/versioned_docs/version-2.4.3/api/drivers/index.md index fdcfc137..506f3d38 100644 --- a/website/versioned_docs/version-2.4.3/api/drivers/index.md +++ b/website/versioned_docs/version-2.4.3/api/drivers/index.md @@ -40,11 +40,9 @@ description: nonebot.drivers 模块 - **说明:** 设置一个 HTTP 服务器路由配置 - **参数** - - `setup` ([HTTPServerSetup](#HTTPServerSetup)) - **返回** - - None ### _abstract method_ `setup_websocket_server(setup)` {#ASGIMixin-setup-websocket-server} @@ -52,23 +50,19 @@ description: nonebot.drivers 模块 - **说明:** 设置一个 WebSocket 服务器路由配置 - **参数** - - `setup` ([WebSocketServerSetup](#WebSocketServerSetup)) - **返回** - - None ## _class_ `Cookies(cookies=None)` {#Cookies} - **参数** - - `cookies` (CookieTypes) ### _method_ `set(name, value, domain="", path="/")` {#Cookies-set} - **参数** - - `name` (str) - `value` (str) @@ -78,13 +72,11 @@ description: nonebot.drivers 模块 - `path` (str) - **返回** - - None ### _method_ `get(name, default=None, domain=None, path=None)` {#Cookies-get} - **参数** - - `name` (str) - `default` (str | None) @@ -94,13 +86,11 @@ description: nonebot.drivers 模块 - `path` (str | None) - **返回** - - str | None ### _method_ `delete(name, domain=None, path=None)` {#Cookies-delete} - **参数** - - `name` (str) - `domain` (str | None) @@ -108,39 +98,32 @@ description: nonebot.drivers 模块 - `path` (str | None) - **返回** - - None ### _method_ `clear(domain=None, path=None)` {#Cookies-clear} - **参数** - - `domain` (str | None) - `path` (str | None) - **返回** - - None ### _method_ `update(cookies=None)` {#Cookies-update} - **参数** - - `cookies` (CookieTypes) - **返回** - - None ### _method_ `as_header(request)` {#Cookies-as-header} - **参数** - - `request` (Request) - **返回** - - dict[str, str] ## _abstract class_ `Driver(env, config)` {#Driver} @@ -152,7 +135,6 @@ description: nonebot.drivers 模块 驱动器控制框架的启动和停止,适配器的注册,以及机器人生命周期管理。 - **参数** - - `env` ([Env](../config.md#Env)): 包含环境信息的 Env 对象 - `config` ([Config](../config.md#Config)): 包含配置信息的 Config 对象 @@ -180,13 +162,11 @@ description: nonebot.drivers 模块 - **说明:** 注册一个协议适配器 - **参数** - - `adapter` (type[[Adapter](../adapters/index.md#Adapter)]): 适配器类 - `**kwargs`: 其他传递给适配器的参数 - **返回** - - None ### _abstract property_ `type` {#Driver-type} @@ -206,13 +186,11 @@ description: nonebot.drivers 模块 - **说明:** 启动驱动框架 - **参数** - - `*args` - `**kwargs` - **返回** - - untyped ### _method_ `on_startup(func)` {#Driver-on-startup} @@ -220,11 +198,9 @@ description: nonebot.drivers 模块 - **说明:** 注册一个启动时执行的函数 - **参数** - - `func` (LIFESPAN_FUNC) - **返回** - - LIFESPAN_FUNC ### _method_ `on_shutdown(func)` {#Driver-on-shutdown} @@ -232,11 +208,9 @@ description: nonebot.drivers 模块 - **说明:** 注册一个停止时执行的函数 - **参数** - - `func` (LIFESPAN_FUNC) - **返回** - - LIFESPAN_FUNC ### _classmethod_ `on_bot_connect(func)` {#Driver-on-bot-connect} @@ -246,15 +220,12 @@ description: nonebot.drivers 模块 装饰一个函数使他在 bot 连接成功时执行。 钩子函数参数: - - bot: 当前连接上的 Bot 对象 - **参数** - - `func` ([T_BotConnectionHook](../typing.md#T-BotConnectionHook)) - **返回** - - [T_BotConnectionHook](../typing.md#T-BotConnectionHook) ### _classmethod_ `on_bot_disconnect(func)` {#Driver-on-bot-disconnect} @@ -264,15 +235,12 @@ description: nonebot.drivers 模块 装饰一个函数使他在 bot 连接断开时执行。 钩子函数参数: - - bot: 当前连接上的 Bot 对象 - **参数** - - `func` ([T_BotDisconnectionHook](../typing.md#T-BotDisconnectionHook)) - **返回** - - [T_BotDisconnectionHook](../typing.md#T-BotDisconnectionHook) ## _var_ `ForwardDriver` {#ForwardDriver} @@ -306,11 +274,9 @@ description: nonebot.drivers 模块 - **说明:** 发送一个 HTTP 请求 - **参数** - - `setup` ([Request](#Request)) - **返回** - - [Response](#Response) ### _abstract method_ `stream_request(setup, *, chunk_size=1024)` {#HTTPClientMixin-stream-request} @@ -318,13 +284,11 @@ description: nonebot.drivers 模块 - **说明:** 发送一个 HTTP 流式请求 - **参数** - - `setup` ([Request](#Request)) - `chunk_size` (int) - **返回** - - AsyncGenerator[[Response](#Response), None] ### _abstract method_ `get_session(params=None, headers=None, cookies=None, version=HTTPVersion.H11, timeout=None, proxy=None)` {#HTTPClientMixin-get-session} @@ -332,7 +296,6 @@ description: nonebot.drivers 模块 - **说明:** 获取一个 HTTP 会话 - **参数** - - `params` (QueryTypes) - `headers` (HeaderTypes) @@ -346,7 +309,6 @@ description: nonebot.drivers 模块 - `proxy` (str | None) - **返回** - - HTTPClientSession ## _class_ `HTTPServerSetup()` {#HTTPServerSetup} @@ -362,7 +324,6 @@ description: nonebot.drivers 模块 - **参数** auto - - `H10: '1.0'` - `H11: '1.1'` @@ -386,7 +347,6 @@ description: nonebot.drivers 模块 ## _class_ `Request(method, url, *, params=None, headers=None, cookies=None, content=None, data=None, json=None, files=None, version=HTTPVersion.H11, timeout=None, proxy=None)` {#Request} - **参数** - - `method` (str | bytes) - `url` (URL | str | RawURL) @@ -414,7 +374,6 @@ description: nonebot.drivers 模块 ## _class_ `Response(status_code, *, headers=None, content=None, request=None)` {#Response} - **参数** - - `status_code` (int) - `headers` (HeaderTypes) @@ -452,7 +411,6 @@ description: nonebot.drivers 模块 ## _abstract class_ `WebSocket(*, request)` {#WebSocket} - **参数** - - `request` (Request) ### _abstract property_ `closed` {#WebSocket-closed} @@ -470,7 +428,6 @@ description: nonebot.drivers 模块 empty - **返回** - - None ### _abstract async method_ `close(code=1000, reason="")` {#WebSocket-close} @@ -478,13 +435,11 @@ description: nonebot.drivers 模块 - **说明:** 关闭 WebSocket 连接请求 - **参数** - - `code` (int) - `reason` (str) - **返回** - - None ### _abstract async method_ `receive()` {#WebSocket-receive} @@ -496,7 +451,6 @@ description: nonebot.drivers 模块 empty - **返回** - - str | bytes ### _abstract async method_ `receive_text()` {#WebSocket-receive-text} @@ -508,7 +462,6 @@ description: nonebot.drivers 模块 empty - **返回** - - str ### _abstract async method_ `receive_bytes()` {#WebSocket-receive-bytes} @@ -520,7 +473,6 @@ description: nonebot.drivers 模块 empty - **返回** - - bytes ### _async method_ `send(data)` {#WebSocket-send} @@ -528,11 +480,9 @@ description: nonebot.drivers 模块 - **说明:** 发送一条 WebSocket text/bytes 信息 - **参数** - - `data` (str | bytes) - **返回** - - None ### _abstract async method_ `send_text(data)` {#WebSocket-send-text} @@ -540,11 +490,9 @@ description: nonebot.drivers 模块 - **说明:** 发送一条 WebSocket text 信息 - **参数** - - `data` (str) - **返回** - - None ### _abstract async method_ `send_bytes(data)` {#WebSocket-send-bytes} @@ -552,11 +500,9 @@ description: nonebot.drivers 模块 - **说明:** 发送一条 WebSocket binary 信息 - **参数** - - `data` (bytes) - **返回** - - None ## _abstract class_ `WebSocketClientMixin()` {#WebSocketClientMixin} @@ -572,11 +518,9 @@ description: nonebot.drivers 模块 - **说明:** 发起一个 WebSocket 连接 - **参数** - - `setup` ([Request](#Request)) - **返回** - - AsyncGenerator[[WebSocket](#WebSocket), None] ## _class_ `WebSocketServerSetup()` {#WebSocketServerSetup} @@ -594,19 +538,14 @@ description: nonebot.drivers 模块 - **重载** **1.** `(driver) -> type[D]` - - **参数** - - `driver` (type[D]) - **返回** - - type[D] **2.** `(driver, __m, /, *mixins) -> type[CombinedDriver]` - - **参数** - - `driver` (type[D]) - `__m` (type[[Mixin](#Mixin)]) @@ -614,5 +553,4 @@ description: nonebot.drivers 模块 - `*mixins` (type[[Mixin](#Mixin)]) - **返回** - - type[CombinedDriver] diff --git a/website/versioned_docs/version-2.4.3/api/drivers/none.md b/website/versioned_docs/version-2.4.3/api/drivers/none.md index 5ef1c558..5422d5dc 100644 --- a/website/versioned_docs/version-2.4.3/api/drivers/none.md +++ b/website/versioned_docs/version-2.4.3/api/drivers/none.md @@ -18,7 +18,6 @@ None 驱动适配 - **说明:** None 驱动框架 - **参数** - - `env` ([Env](../config.md#Env)) - `config` ([Config](../config.md#Config)) @@ -40,13 +39,11 @@ None 驱动适配 - **说明:** 启动 none driver - **参数** - - `*args` - `**kwargs` - **返回** - - untyped ### _method_ `exit(force=False)` {#Driver-exit} @@ -54,9 +51,7 @@ None 驱动适配 - **说明:** 退出 none driver - **参数** - - `force` (bool): 强制退出 - **返回** - - untyped diff --git a/website/versioned_docs/version-2.4.3/api/drivers/quart.md b/website/versioned_docs/version-2.4.3/api/drivers/quart.md index 508366fe..dd8dbb35 100644 --- a/website/versioned_docs/version-2.4.3/api/drivers/quart.md +++ b/website/versioned_docs/version-2.4.3/api/drivers/quart.md @@ -68,7 +68,6 @@ pip install nonebot2[quart] - **说明:** Quart 驱动框架 - **参数** - - `env` ([Env](../config.md#Env)) - `config` (NoneBotConfig) @@ -100,21 +99,17 @@ pip install nonebot2[quart] ### _method_ `setup_http_server(setup)` {#Driver-setup-http-server} - **参数** - - `setup` ([HTTPServerSetup](index.md#HTTPServerSetup)) - **返回** - - untyped ### _method_ `setup_websocket_server(setup)` {#Driver-setup-websocket-server} - **参数** - - `setup` ([WebSocketServerSetup](index.md#WebSocketServerSetup)) - **返回** - - None ### _method_ `run(host=None, port=None, *args, app=None, **kwargs)` {#Driver-run} @@ -122,7 +117,6 @@ pip install nonebot2[quart] - **说明:** 使用 `uvicorn` 启动 Quart - **参数** - - `host` (str | None) - `port` (int | None) @@ -134,7 +128,6 @@ pip install nonebot2[quart] - `**kwargs` - **返回** - - untyped ## _class_ `WebSocket(*, request, websocket_ctx)` {#WebSocket} @@ -142,7 +135,6 @@ pip install nonebot2[quart] - **说明:** Quart WebSocket Wrapper - **参数** - - `request` (BaseRequest) - `websocket_ctx` (WebsocketContext) @@ -154,19 +146,16 @@ pip install nonebot2[quart] empty - **返回** - - untyped ### _async method_ `close(code=1000, reason="")` {#WebSocket-close} - **参数** - - `code` (int) - `reason` (str) - **返回** - - untyped ### _async method_ `receive()` {#WebSocket-receive} @@ -176,7 +165,6 @@ pip install nonebot2[quart] empty - **返回** - - str | bytes ### _async method_ `receive_text()` {#WebSocket-receive-text} @@ -186,7 +174,6 @@ pip install nonebot2[quart] empty - **返回** - - str ### _async method_ `receive_bytes()` {#WebSocket-receive-bytes} @@ -196,25 +183,20 @@ pip install nonebot2[quart] empty - **返回** - - bytes ### _async method_ `send_text(data)` {#WebSocket-send-text} - **参数** - - `data` (str) - **返回** - - untyped ### _async method_ `send_bytes(data)` {#WebSocket-send-bytes} - **参数** - - `data` (bytes) - **返回** - - untyped diff --git a/website/versioned_docs/version-2.4.3/api/drivers/websockets.md b/website/versioned_docs/version-2.4.3/api/drivers/websockets.md index 82df1bd1..b720083c 100644 --- a/website/versioned_docs/version-2.4.3/api/drivers/websockets.md +++ b/website/versioned_docs/version-2.4.3/api/drivers/websockets.md @@ -22,11 +22,9 @@ pip install nonebot2[websockets] ## _def_ `catch_closed(func)` {#catch-closed} - **参数** - - `func` ((P) -> CoroutineType[Any, Any, T]) - **返回** - - (P) -> CoroutineType[Any, Any, T] ## _class_ `Mixin()` {#Mixin} @@ -40,11 +38,9 @@ pip install nonebot2[websockets] ### _method_ `websocket(setup)` {#Mixin-websocket} - **参数** - - `setup` ([Request](index.md#Request)) - **返回** - - AsyncGenerator[[WebSocket](index.md#WebSocket), None] ## _class_ `WebSocket(*, request, websocket)` {#WebSocket} @@ -52,7 +48,6 @@ pip install nonebot2[websockets] - **说明:** Websockets WebSocket Wrapper - **参数** - - `request` ([Request](index.md#Request)) - `websocket` (ClientConnection) @@ -64,19 +59,16 @@ pip install nonebot2[websockets] empty - **返回** - - untyped ### _async method_ `close(code=1000, reason="")` {#WebSocket-close} - **参数** - - `code` (int) - `reason` (str) - **返回** - - untyped ### _async method_ `receive()` {#WebSocket-receive} @@ -86,7 +78,6 @@ pip install nonebot2[websockets] empty - **返回** - - str | bytes ### _async method_ `receive_text()` {#WebSocket-receive-text} @@ -96,7 +87,6 @@ pip install nonebot2[websockets] empty - **返回** - - str ### _async method_ `receive_bytes()` {#WebSocket-receive-bytes} @@ -106,33 +96,27 @@ pip install nonebot2[websockets] empty - **返回** - - bytes ### _async method_ `send_text(data)` {#WebSocket-send-text} - **参数** - - `data` (str) - **返回** - - None ### _async method_ `send_bytes(data)` {#WebSocket-send-bytes} - **参数** - - `data` (bytes) - **返回** - - None ## _class_ `Driver(env, config)` {#Driver} - **参数** - - `env` ([Env](../config.md#Env)) - `config` ([Config](../config.md#Config)) diff --git a/website/versioned_docs/version-2.4.3/api/exception.md b/website/versioned_docs/version-2.4.3/api/exception.md index 823332c4..0365e1fd 100644 --- a/website/versioned_docs/version-2.4.3/api/exception.md +++ b/website/versioned_docs/version-2.4.3/api/exception.md @@ -62,7 +62,6 @@ NoneBotException - **说明:** 指示 NoneBot 应该忽略该事件。可由 PreProcessor 抛出。 - **参数** - - `reason`: 忽略事件的原因 ## _class_ `SkippedException()` {#SkippedException} @@ -101,7 +100,6 @@ NoneBotException - **说明:** 指示 NoneBot 阻止本次 API 调用或修改本次调用返回值,并返回自定义内容。 可由 api hook 抛出。 - **参数** - - `result`: 返回的内容 ## _class_ `StopPropagation()` {#StopPropagation} @@ -200,7 +198,6 @@ NoneBotException - **说明:** 代表 `Adapter` 抛出的异常,所有的 `Adapter` 都要在内部继承自这个 `Exception`。 - **参数** - - `adapter_name`: 标识 adapter ## _class_ `NoLogException()` {#NoLogException} diff --git a/website/versioned_docs/version-2.4.3/api/index.md b/website/versioned_docs/version-2.4.3/api/index.md index aecfab21..56305d35 100644 --- a/website/versioned_docs/version-2.4.3/api/index.md +++ b/website/versioned_docs/version-2.4.3/api/index.md @@ -60,11 +60,9 @@ description: nonebot 模块 empty - **返回** - - [Driver](drivers/index.md#Driver): 全局 [Driver](drivers/index.md#Driver) 对象 - **异常** - - ValueError: 全局 [Driver](drivers/index.md#Driver) 对象尚未初始化 ([nonebot.init](#init) 尚未调用) - **用法** @@ -80,27 +78,20 @@ description: nonebot 模块 - **重载** **1.** `(name) -> Adapter` - - **参数** - - `name` (str): 适配器名称 - **返回** - - [Adapter](adapters/index.md#Adapter): 指定名称的 [Adapter](adapters/index.md#Adapter) 对象 **2.** `(name) -> A` - - **参数** - - `name` (type[A]): 适配器类型 - **返回** - - A: 指定类型的 [Adapter](adapters/index.md#Adapter) 对象 - **异常** - - ValueError: 指定的 [Adapter](adapters/index.md#Adapter) 未注册 - ValueError: 全局 [Driver](drivers/index.md#Driver) 对象尚未初始化 ([nonebot.init](#init) 尚未调用) @@ -121,11 +112,9 @@ description: nonebot 模块 empty - **返回** - - dict[str, [Adapter](adapters/index.md#Adapter)]: 所有 [Adapter](adapters/index.md#Adapter) 实例字典 - **异常** - - ValueError: 全局 [Driver](drivers/index.md#Driver) 对象尚未初始化 ([nonebot.init](#init) 尚未调用) - **用法** @@ -143,11 +132,9 @@ description: nonebot 模块 empty - **返回** - - Any: Server App 对象 - **异常** - - AssertionError: 全局 Driver 对象不是 [ASGIMixin](drivers/index.md#ASGIMixin) 类型 - ValueError: 全局 [Driver](drivers/index.md#Driver) 对象尚未初始化 ([nonebot.init](#init) 尚未调用) @@ -167,11 +154,9 @@ description: nonebot 模块 empty - **返回** - - Any: ASGI 对象 - **异常** - - AssertionError: 全局 Driver 对象不是 [ASGIMixin](drivers/index.md#ASGIMixin) 类型 - ValueError: 全局 [Driver](drivers/index.md#Driver) 对象尚未初始化 ([nonebot.init](#init) 尚未调用) @@ -192,15 +177,12 @@ description: nonebot 模块 当不提供时,返回一个 [Bot](adapters/index.md#Bot)。 - **参数** - - `self_id` (str | None): 用来识别 [Bot](adapters/index.md#Bot) 的 [Bot.self_id](adapters/index.md#Bot-self-id) 属性 - **返回** - - [Bot](adapters/index.md#Bot): [Bot](adapters/index.md#Bot) 对象 - **异常** - - KeyError: 对应 self_id 的 Bot 不存在 - ValueError: 没有传入 self_id 且没有 Bot 可用 @@ -224,13 +206,11 @@ description: nonebot 模块 empty - **返回** - - dict[str, [Bot](adapters/index.md#Bot)]: 一个以 [Bot.self_id](adapters/index.md#Bot-self-id) 为键 [Bot](adapters/index.md#Bot) 对象为值的字典 - **异常** - - ValueError: 全局 [Driver](drivers/index.md#Driver) 对象尚未初始化 ([nonebot.init](#init) 尚未调用) - **用法** @@ -250,13 +230,11 @@ description: nonebot 模块 也可以传入自定义的 `_env_file` 来指定 NoneBot 从该文件读取配置。 - **参数** - - `_env_file` (DOTENV_TYPE | None): 配置文件名,默认从 `.env.{env_name}` 中读取配置 - `**kwargs` (Any): 任意变量,将会存储到 [Driver.config](drivers/index.md#Driver-config) 对象里 - **返回** - - None - **用法** @@ -270,13 +248,11 @@ description: nonebot 模块 - **说明:** 启动 NoneBot,即运行全局 [Driver](drivers/index.md#Driver) 对象。 - **参数** - - `*args` (Any): 传入 [Driver.run](drivers/index.md#Driver-run) 的位置参数 - `**kwargs` (Any): 传入 [Driver.run](drivers/index.md#Driver-run) 的命名参数 - **返回** - - None - **用法** diff --git a/website/versioned_docs/version-2.4.3/api/log.md b/website/versioned_docs/version-2.4.3/api/log.md index 18bf08d6..636847e5 100644 --- a/website/versioned_docs/version-2.4.3/api/log.md +++ b/website/versioned_docs/version-2.4.3/api/log.md @@ -25,7 +25,6 @@ NoneBot 使用 [`loguru`][loguru] 来记录日志信息。 NoneBot 日志记录器对象。 默认信息: - - 格式: `[%(asctime)s %(name)s] %(levelname)s: %(message)s` - 等级: `INFO` ,根据 `config.log_level` 配置改变 - 输出: 输出至 stdout @@ -47,11 +46,9 @@ NoneBot 使用 [`loguru`][loguru] 来记录日志信息。 ### _method_ `emit(record)` {#LoguruHandler-emit} - **参数** - - `record` (logging.LogRecord) - **返回** - - untyped ## _def_ `default_filter(record)` {#default-filter} @@ -59,11 +56,9 @@ NoneBot 使用 [`loguru`][loguru] 来记录日志信息。 - **说明:** 默认的日志过滤器,根据 `config.log_level` 配置改变日志等级。 - **参数** - - `record` (Record) - **返回** - - untyped ## _var_ `default_format` {#default-format} diff --git a/website/versioned_docs/version-2.4.3/api/matcher.md b/website/versioned_docs/version-2.4.3/api/matcher.md index 8e9fdd08..78c7d364 100644 --- a/website/versioned_docs/version-2.4.3/api/matcher.md +++ b/website/versioned_docs/version-2.4.3/api/matcher.md @@ -76,7 +76,6 @@ description: nonebot.matcher 模块 - **说明:** 创建一个新的事件响应器,并存储至 `matchers <#matchers>`\_ - **参数** - - `type_` (str): 事件响应器类型,与 `event.get_type()` 一致时触发,空字符串表示任意 - `rule` ([Rule](rule.md#Rule) | None): 匹配规则 @@ -106,7 +105,6 @@ description: nonebot.matcher 模块 - `default_permission_updater` ([T_PermissionUpdater](typing.md#T-PermissionUpdater) | [Dependent](dependencies/index.md#Dependent)[[Permission](permission.md#Permission)] | None): 默认会话权限更新函数 - **返回** - - type[Matcher]: 新的事件响应器类 ### _classmethod_ `destroy()` {#Matcher-destroy} @@ -118,7 +116,6 @@ description: nonebot.matcher 模块 empty - **返回** - - None ### _classmethod_ `check_perm(bot, event, stack=None, dependency_cache=None)` {#Matcher-check-perm} @@ -126,7 +123,6 @@ description: nonebot.matcher 模块 - **说明:** 检查是否满足触发权限 - **参数** - - `bot` ([Bot](adapters/index.md#Bot)): Bot 对象 - `event` ([Event](adapters/index.md#Event)): 上报事件 @@ -136,7 +132,6 @@ description: nonebot.matcher 模块 - `dependency_cache` ([T_DependencyCache](typing.md#T-DependencyCache) | None): 依赖缓存 - **返回** - - bool: 是否满足权限 ### _classmethod_ `check_rule(bot, event, state, stack=None, dependency_cache=None)` {#Matcher-check-rule} @@ -144,7 +139,6 @@ description: nonebot.matcher 模块 - **说明:** 检查是否满足匹配规则 - **参数** - - `bot` ([Bot](adapters/index.md#Bot)): Bot 对象 - `event` ([Event](adapters/index.md#Event)): 上报事件 @@ -156,7 +150,6 @@ description: nonebot.matcher 模块 - `dependency_cache` ([T_DependencyCache](typing.md#T-DependencyCache) | None): 依赖缓存 - **返回** - - bool: 是否满足匹配规则 ### _classmethod_ `type_updater(func)` {#Matcher-type-updater} @@ -164,11 +157,9 @@ description: nonebot.matcher 模块 - **说明:** 装饰一个函数来更改当前事件响应器的默认响应事件类型更新函数 - **参数** - - `func` ([T_TypeUpdater](typing.md#T-TypeUpdater)): 响应事件类型更新函数 - **返回** - - [T_TypeUpdater](typing.md#T-TypeUpdater) ### _classmethod_ `permission_updater(func)` {#Matcher-permission-updater} @@ -176,23 +167,19 @@ description: nonebot.matcher 模块 - **说明:** 装饰一个函数来更改当前事件响应器的默认会话权限更新函数 - **参数** - - `func` ([T_PermissionUpdater](typing.md#T-PermissionUpdater)): 会话权限更新函数 - **返回** - - [T_PermissionUpdater](typing.md#T-PermissionUpdater) ### _classmethod_ `append_handler(handler, parameterless=None)` {#Matcher-append-handler} - **参数** - - `handler` ([T_Handler](typing.md#T-Handler)) - `parameterless` (Iterable[Any] | None) - **返回** - - [Dependent](dependencies/index.md#Dependent)[Any] ### _classmethod_ `handle(parameterless=None)` {#Matcher-handle} @@ -200,11 +187,9 @@ description: nonebot.matcher 模块 - **说明:** 装饰一个函数来向事件响应器直接添加一个处理函数 - **参数** - - `parameterless` (Iterable[Any] | None): 非参数类型依赖列表 - **返回** - - ([T_Handler](typing.md#T-Handler)) -> [T_Handler](typing.md#T-Handler) ### _classmethod_ `receive(id="", parameterless=None)` {#Matcher-receive} @@ -212,13 +197,11 @@ description: nonebot.matcher 模块 - **说明:** 装饰一个函数来指示 NoneBot 在接收用户新的一条消息后继续运行该函数 - **参数** - - `id` (str): 消息 ID - `parameterless` (Iterable[Any] | None): 非参数类型依赖列表 - **返回** - - ([T_Handler](typing.md#T-Handler)) -> [T_Handler](typing.md#T-Handler) ### _classmethod_ `got(key, prompt=None, parameterless=None)` {#Matcher-got} @@ -231,7 +214,6 @@ description: nonebot.matcher 模块 如果 `key` 已存在则直接继续运行 - **参数** - - `key` (str): 参数名 - `prompt` (str | [Message](adapters/index.md#Message) | [MessageSegment](adapters/index.md#MessageSegment) | [MessageTemplate](adapters/index.md#MessageTemplate) | None): 在参数不存在时向用户发送的消息 @@ -239,7 +221,6 @@ description: nonebot.matcher 模块 - `parameterless` (Iterable[Any] | None): 非参数类型依赖列表 - **返回** - - ([T_Handler](typing.md#T-Handler)) -> [T_Handler](typing.md#T-Handler) ### _classmethod_ `send(message, **kwargs)` {#Matcher-send} @@ -247,13 +228,11 @@ description: nonebot.matcher 模块 - **说明:** 发送一条消息给当前交互用户 - **参数** - - `message` (str | [Message](adapters/index.md#Message) | [MessageSegment](adapters/index.md#MessageSegment) | [MessageTemplate](adapters/index.md#MessageTemplate)): 消息内容 - `**kwargs` (Any): [Bot.send](adapters/index.md#Bot-send) 的参数, 请参考对应 adapter 的 bot 对象 api - **返回** - - Any ### _classmethod_ `finish(message=None, **kwargs)` {#Matcher-finish} @@ -261,13 +240,11 @@ description: nonebot.matcher 模块 - **说明:** 发送一条消息给当前交互用户并结束当前事件响应器 - **参数** - - `message` (str | [Message](adapters/index.md#Message) | [MessageSegment](adapters/index.md#MessageSegment) | [MessageTemplate](adapters/index.md#MessageTemplate) | None): 消息内容 - `**kwargs`: [Bot.send](adapters/index.md#Bot-send) 的参数, 请参考对应 adapter 的 bot 对象 api - **返回** - - NoReturn ### _classmethod_ `pause(prompt=None, **kwargs)` {#Matcher-pause} @@ -275,13 +252,11 @@ description: nonebot.matcher 模块 - **说明:** 发送一条消息给当前交互用户并暂停事件响应器,在接收用户新的一条消息后继续下一个处理函数 - **参数** - - `prompt` (str | [Message](adapters/index.md#Message) | [MessageSegment](adapters/index.md#MessageSegment) | [MessageTemplate](adapters/index.md#MessageTemplate) | None): 消息内容 - `**kwargs`: [Bot.send](adapters/index.md#Bot-send) 的参数, 请参考对应 adapter 的 bot 对象 api - **返回** - - NoReturn ### _classmethod_ `reject(prompt=None, **kwargs)` {#Matcher-reject} @@ -289,13 +264,11 @@ description: nonebot.matcher 模块 - **说明:** 最近使用 `got` / `receive` 接收的消息不符合预期, 发送一条消息给当前交互用户并将当前事件处理流程中断在当前位置,在接收用户新的一个事件后从头开始执行当前处理函数 - **参数** - - `prompt` (str | [Message](adapters/index.md#Message) | [MessageSegment](adapters/index.md#MessageSegment) | [MessageTemplate](adapters/index.md#MessageTemplate) | None): 消息内容 - `**kwargs`: [Bot.send](adapters/index.md#Bot-send) 的参数, 请参考对应 adapter 的 bot 对象 api - **返回** - - NoReturn ### _classmethod_ `reject_arg(key, prompt=None, **kwargs)` {#Matcher-reject-arg} @@ -303,7 +276,6 @@ description: nonebot.matcher 模块 - **说明:** 最近使用 `got` 接收的消息不符合预期, 发送一条消息给当前交互用户并将当前事件处理流程中断在当前位置,在接收用户新的一条消息后从头开始执行当前处理函数 - **参数** - - `key` (str): 参数名 - `prompt` (str | [Message](adapters/index.md#Message) | [MessageSegment](adapters/index.md#MessageSegment) | [MessageTemplate](adapters/index.md#MessageTemplate) | None): 消息内容 @@ -311,7 +283,6 @@ description: nonebot.matcher 模块 - `**kwargs`: [Bot.send](adapters/index.md#Bot-send) 的参数, 请参考对应 adapter 的 bot 对象 api - **返回** - - NoReturn ### _classmethod_ `reject_receive(id="", prompt=None, **kwargs)` {#Matcher-reject-receive} @@ -319,7 +290,6 @@ description: nonebot.matcher 模块 - **说明:** 最近使用 `receive` 接收的消息不符合预期, 发送一条消息给当前交互用户并将当前事件处理流程中断在当前位置,在接收用户新的一个事件后从头开始执行当前处理函数 - **参数** - - `id` (str): 消息 id - `prompt` (str | [Message](adapters/index.md#Message) | [MessageSegment](adapters/index.md#MessageSegment) | [MessageTemplate](adapters/index.md#MessageTemplate) | None): 消息内容 @@ -327,7 +297,6 @@ description: nonebot.matcher 模块 - `**kwargs`: [Bot.send](adapters/index.md#Bot-send) 的参数, 请参考对应 adapter 的 bot 对象 api - **返回** - - NoReturn ### _classmethod_ `skip()` {#Matcher-skip} @@ -343,7 +312,6 @@ description: nonebot.matcher 模块 empty - **返回** - - NoReturn ### _method_ `get_receive(id, default=None)` {#Matcher-get-receive} @@ -357,25 +325,19 @@ description: nonebot.matcher 模块 - **重载** **1.** `(id) -> Event | None` - - **参数** - - `id` (str) - **返回** - - [Event](adapters/index.md#Event) | None **2.** `(id, default) -> Event | T` - - **参数** - - `id` (str) - `default` (T) - **返回** - - [Event](adapters/index.md#Event) | T ### _method_ `set_receive(id, event)` {#Matcher-set-receive} @@ -383,13 +345,11 @@ description: nonebot.matcher 模块 - **说明:** 设置一个 `receive` 事件 - **参数** - - `id` (str) - `event` ([Event](adapters/index.md#Event)) - **返回** - - None ### _method_ `get_last_receive(default=None)` {#Matcher-get-last-receive} @@ -403,23 +363,18 @@ description: nonebot.matcher 模块 - **重载** **1.** `() -> Event | None` - - **参数** empty - **返回** - - [Event](adapters/index.md#Event) | None **2.** `(default) -> Event | T` - - **参数** - - `default` (T) - **返回** - - [Event](adapters/index.md#Event) | T ### _method_ `get_arg(key, default=None)` {#Matcher-get-arg} @@ -433,25 +388,19 @@ description: nonebot.matcher 模块 - **重载** **1.** `(key) -> Message | None` - - **参数** - - `key` (str) - **返回** - - [Message](adapters/index.md#Message) | None **2.** `(key, default) -> Message | T` - - **参数** - - `key` (str) - `default` (T) - **返回** - - [Message](adapters/index.md#Message) | T ### _method_ `set_arg(key, message)` {#Matcher-set-arg} @@ -459,25 +408,21 @@ description: nonebot.matcher 模块 - **说明:** 设置一个 `got` 消息 - **参数** - - `key` (str) - `message` ([Message](adapters/index.md#Message)) - **返回** - - None ### _method_ `set_target(target, cache=True)` {#Matcher-set-target} - **参数** - - `target` (str) - `cache` (bool) - **返回** - - None ### _method_ `get_target(default=None)` {#Matcher-get-target} @@ -485,23 +430,18 @@ description: nonebot.matcher 模块 - **重载** **1.** `() -> str | None` - - **参数** empty - **返回** - - str | None **2.** `(default) -> str | T` - - **参数** - - `default` (T) - **返回** - - str | T ### _method_ `stop_propagation()` {#Matcher-stop-propagation} @@ -513,13 +453,11 @@ description: nonebot.matcher 模块 empty - **返回** - - untyped ### _async method_ `update_type(bot, event, stack=None, dependency_cache=None)` {#Matcher-update-type} - **参数** - - `bot` ([Bot](adapters/index.md#Bot)) - `event` ([Event](adapters/index.md#Event)) @@ -529,13 +467,11 @@ description: nonebot.matcher 模块 - `dependency_cache` ([T_DependencyCache](typing.md#T-DependencyCache) | None) - **返回** - - str ### _async method_ `update_permission(bot, event, stack=None, dependency_cache=None)` {#Matcher-update-permission} - **参数** - - `bot` ([Bot](adapters/index.md#Bot)) - `event` ([Event](adapters/index.md#Event)) @@ -545,7 +481,6 @@ description: nonebot.matcher 模块 - `dependency_cache` ([T_DependencyCache](typing.md#T-DependencyCache) | None) - **返回** - - [Permission](permission.md#Permission) ### _async method_ `resolve_reject()` {#Matcher-resolve-reject} @@ -555,25 +490,21 @@ description: nonebot.matcher 模块 empty - **返回** - - untyped ### _method_ `ensure_context(bot, event)` {#Matcher-ensure-context} - **参数** - - `bot` ([Bot](adapters/index.md#Bot)) - `event` ([Event](adapters/index.md#Event)) - **返回** - - untyped ### _async method_ `simple_run(bot, event, state, stack=None, dependency_cache=None)` {#Matcher-simple-run} - **参数** - - `bot` ([Bot](adapters/index.md#Bot)) - `event` ([Event](adapters/index.md#Event)) @@ -585,13 +516,11 @@ description: nonebot.matcher 模块 - `dependency_cache` ([T_DependencyCache](typing.md#T-DependencyCache) | None) - **返回** - - untyped ### _async method_ `run(bot, event, state, stack=None, dependency_cache=None)` {#Matcher-run} - **参数** - - `bot` ([Bot](adapters/index.md#Bot)) - `event` ([Event](adapters/index.md#Event)) @@ -603,7 +532,6 @@ description: nonebot.matcher 模块 - `dependency_cache` ([T_DependencyCache](typing.md#T-DependencyCache) | None) - **返回** - - untyped ## _class_ `MatcherManager()` {#MatcherManager} @@ -625,7 +553,6 @@ description: nonebot.matcher 模块 empty - **返回** - - KeysView[int] ### _method_ `values()` {#MatcherManager-values} @@ -635,7 +562,6 @@ description: nonebot.matcher 模块 empty - **返回** - - ValuesView[list[type[[Matcher](#Matcher)]]] ### _method_ `items()` {#MatcherManager-items} @@ -645,7 +571,6 @@ description: nonebot.matcher 模块 empty - **返回** - - ItemsView[int, list[type[[Matcher](#Matcher)]]] ### _method_ `get(key, default=None)` {#MatcherManager-get} @@ -653,47 +578,36 @@ description: nonebot.matcher 模块 - **重载** **1.** `(key) -> list[type[Matcher]] | None` - - **参数** - - `key` (int) - **返回** - - list[type[[Matcher](#Matcher)]] | None **2.** `(key, default) -> list[type[Matcher]]` - - **参数** - - `key` (int) - `default` (list[type[[Matcher](#Matcher)]]) - **返回** - - list[type[[Matcher](#Matcher)]] **3.** `(key, default) -> list[type[Matcher]] | T` - - **参数** - - `key` (int) - `default` (T) - **返回** - - list[type[[Matcher](#Matcher)]] | T ### _method_ `pop(key)` {#MatcherManager-pop} - **参数** - - `key` (int) - **返回** - - list[type[[Matcher](#Matcher)]] ### _method_ `popitem()` {#MatcherManager-popitem} @@ -703,7 +617,6 @@ description: nonebot.matcher 模块 empty - **返回** - - tuple[int, list[type[[Matcher](#Matcher)]]] ### _method_ `clear()` {#MatcherManager-clear} @@ -713,29 +626,24 @@ description: nonebot.matcher 模块 empty - **返回** - - None ### _method_ `update(m, /)` {#MatcherManager-update} - **参数** - - `m` (MutableMapping[int, list[type[[Matcher](#Matcher)]]]) - **返回** - - None ### _method_ `setdefault(key, default)` {#MatcherManager-setdefault} - **参数** - - `key` (int) - `default` (list[type[[Matcher](#Matcher)]]) - **返回** - - list[type[[Matcher](#Matcher)]] ### _method_ `set_provider(provider_class)` {#MatcherManager-set-provider} @@ -743,11 +651,9 @@ description: nonebot.matcher 模块 - **说明:** 设置事件响应器存储器 - **参数** - - `provider_class` (type[[MatcherProvider](#MatcherProvider)]): 事件响应器存储器类 - **返回** - - None ## _abstract class_ `MatcherProvider(matchers)` {#MatcherProvider} @@ -755,7 +661,6 @@ description: nonebot.matcher 模块 - **说明:** 事件响应器存储器基类 - **参数** - - `matchers` (Mapping[int, list[type[[Matcher](#Matcher)]]]): 当前存储器中已有的事件响应器 ## _var_ `matchers` {#matchers} diff --git a/website/versioned_docs/version-2.4.3/api/message.md b/website/versioned_docs/version-2.4.3/api/message.md index 73622df3..ad785e3d 100644 --- a/website/versioned_docs/version-2.4.3/api/message.md +++ b/website/versioned_docs/version-2.4.3/api/message.md @@ -20,11 +20,9 @@ NoneBot 内部处理并按优先级分发事件给所有事件响应器,提供 装饰一个函数,使它在每次接收到事件并分发给各响应器之前执行。 - **参数** - - `func` ([T_EventPreProcessor](typing.md#T-EventPreProcessor)) - **返回** - - [T_EventPreProcessor](typing.md#T-EventPreProcessor) ## _def_ `event_postprocessor(func)` {#event-postprocessor} @@ -36,11 +34,9 @@ NoneBot 内部处理并按优先级分发事件给所有事件响应器,提供 装饰一个函数,使它在每次接收到事件并分发给各响应器之后执行。 - **参数** - - `func` ([T_EventPostProcessor](typing.md#T-EventPostProcessor)) - **返回** - - [T_EventPostProcessor](typing.md#T-EventPostProcessor) ## _def_ `run_preprocessor(func)` {#run-preprocessor} @@ -52,11 +48,9 @@ NoneBot 内部处理并按优先级分发事件给所有事件响应器,提供 装饰一个函数,使它在每次事件响应器运行前执行。 - **参数** - - `func` ([T_RunPreProcessor](typing.md#T-RunPreProcessor)) - **返回** - - [T_RunPreProcessor](typing.md#T-RunPreProcessor) ## _def_ `run_postprocessor(func)` {#run-postprocessor} @@ -68,11 +62,9 @@ NoneBot 内部处理并按优先级分发事件给所有事件响应器,提供 装饰一个函数,使它在每次事件响应器运行后执行。 - **参数** - - `func` ([T_RunPostProcessor](typing.md#T-RunPostProcessor)) - **返回** - - [T_RunPostProcessor](typing.md#T-RunPostProcessor) ## _async def_ `check_and_run_matcher(Matcher, bot, event, state, stack=None, dependency_cache=None)` {#check-and-run-matcher} @@ -80,7 +72,6 @@ NoneBot 内部处理并按优先级分发事件给所有事件响应器,提供 - **说明:** 检查并运行事件响应器。 - **参数** - - `Matcher` (type[[Matcher](matcher.md#Matcher)]): 事件响应器 - `bot` ([Bot](adapters/index.md#Bot)): Bot 对象 @@ -94,7 +85,6 @@ NoneBot 内部处理并按优先级分发事件给所有事件响应器,提供 - `dependency_cache` ([T_DependencyCache](typing.md#T-DependencyCache) | None): 依赖缓存 - **返回** - - None ## _async def_ `handle_event(bot, event)` {#handle-event} @@ -102,13 +92,11 @@ NoneBot 内部处理并按优先级分发事件给所有事件响应器,提供 - **说明:** 处理一个事件。调用该函数以实现分发事件。 - **参数** - - `bot` ([Bot](adapters/index.md#Bot)): Bot 对象 - `event` ([Event](adapters/index.md#Event)): Event 对象 - **返回** - - None - **用法** diff --git a/website/versioned_docs/version-2.4.3/api/params.md b/website/versioned_docs/version-2.4.3/api/params.md index 0af076cb..9f5775c0 100644 --- a/website/versioned_docs/version-2.4.3/api/params.md +++ b/website/versioned_docs/version-2.4.3/api/params.md @@ -14,11 +14,9 @@ description: nonebot.params 模块 - **说明:** Arg 参数消息 - **参数** - - `key` (str | None) - **返回** - - Any ## _class_ `ArgParam(*args, key, type, **kwargs)` {#ArgParam} @@ -33,7 +31,6 @@ description: nonebot.params 模块 留空则会根据参数名称获取。 - **参数** - - `*args` - `key` (str) @@ -47,11 +44,9 @@ description: nonebot.params 模块 - **说明:** Arg 参数消息纯文本 - **参数** - - `key` (str | None) - **返回** - - str ## _def_ `ArgPromptResult(key=None)` {#ArgPromptResult} @@ -59,11 +54,9 @@ description: nonebot.params 模块 - **说明:** `arg` prompt 发送结果 - **参数** - - `key` (str | None) - **返回** - - Any ## _def_ `ArgStr(key=None)` {#ArgStr} @@ -71,11 +64,9 @@ description: nonebot.params 模块 - **说明:** Arg 参数消息文本 - **参数** - - `key` (str | None) - **返回** - - str ## _class_ `BotParam(*args, checker=None, **kwargs)` {#BotParam} @@ -89,7 +80,6 @@ description: nonebot.params 模块 为保证兼容性,本注入还会解析名为 `bot` 且没有类型注解的参数。 - **参数** - - `*args` - `checker` ([ModelField](compat.md#ModelField) | None) @@ -107,7 +97,6 @@ description: nonebot.params 模块 本注入参数应该具有最低优先级,因此应该在所有其他注入参数之后使用。 - **参数** - - `*args` - `validate` (bool) @@ -125,7 +114,6 @@ description: nonebot.params 模块 本注入应该具有最高优先级,因此应该在其他参数之前检查。 - **参数** - - `*args` - `dependent` ([Dependent](dependencies/index.md#Dependent)[Any]) @@ -139,7 +127,6 @@ description: nonebot.params 模块 - **说明:** 子依赖装饰器 - **参数** - - `dependency` ([T_Handler](typing.md#T-Handler) | None): 依赖函数。默认为参数的类型注释。 - `use_cache` (bool): 是否使用缓存。默认为 `True`。 @@ -147,7 +134,6 @@ description: nonebot.params 模块 - `validate` (bool | PydanticFieldInfo): 是否使用 Pydantic 类型校验。默认为 `False`。 - **返回** - - Any - **用法** @@ -180,7 +166,6 @@ description: nonebot.params 模块 为保证兼容性,本注入还会解析名为 `event` 且没有类型注解的参数。 - **参数** - - `*args` - `checker` ([ModelField](compat.md#ModelField) | None) @@ -198,7 +183,6 @@ description: nonebot.params 模块 为保证兼容性,本注入还会解析名为 `exception` 且没有类型注解的参数。 - **参数** - - `*args` - `validate` (bool) @@ -216,7 +200,6 @@ description: nonebot.params 模块 为保证兼容性,本注入还会解析名为 `matcher` 且没有类型注解的参数。 - **参数** - - `*args` - `checker` ([ModelField](compat.md#ModelField) | None) @@ -234,7 +217,6 @@ description: nonebot.params 模块 为保证兼容性,本注入还会解析名为 `state` 且没有类型注解的参数。 - **参数** - - `*args` - `validate` (bool) @@ -250,7 +232,6 @@ description: nonebot.params 模块 empty - **返回** - - str ## _def_ `EventMessage()` {#EventMessage} @@ -262,7 +243,6 @@ description: nonebot.params 模块 empty - **返回** - - Any ## _def_ `EventPlainText()` {#EventPlainText} @@ -274,7 +254,6 @@ description: nonebot.params 模块 empty - **返回** - - str ## _def_ `EventToMe()` {#EventToMe} @@ -286,7 +265,6 @@ description: nonebot.params 模块 empty - **返回** - - bool ## _def_ `Command()` {#Command} @@ -298,7 +276,6 @@ description: nonebot.params 模块 empty - **返回** - - tuple[str, ...] ## _def_ `RawCommand()` {#RawCommand} @@ -310,7 +287,6 @@ description: nonebot.params 模块 empty - **返回** - - str ## _def_ `CommandArg()` {#CommandArg} @@ -322,7 +298,6 @@ description: nonebot.params 模块 empty - **返回** - - Any ## _def_ `CommandStart()` {#CommandStart} @@ -334,7 +309,6 @@ description: nonebot.params 模块 empty - **返回** - - str ## _def_ `CommandWhitespace()` {#CommandWhitespace} @@ -346,7 +320,6 @@ description: nonebot.params 模块 empty - **返回** - - str ## _def_ `ShellCommandArgs()` {#ShellCommandArgs} @@ -358,7 +331,6 @@ description: nonebot.params 模块 empty - **返回** - - Any ## _def_ `ShellCommandArgv()` {#ShellCommandArgv} @@ -370,7 +342,6 @@ description: nonebot.params 模块 empty - **返回** - - Any ## _def_ `RegexMatched()` {#RegexMatched} @@ -382,7 +353,6 @@ description: nonebot.params 模块 empty - **返回** - - Match[str] ## _def_ `RegexStr(*groups)` {#RegexStr} @@ -392,29 +362,21 @@ description: nonebot.params 模块 - **重载** **1.** `(group, /) -> str` - - **参数** - - `group` (Literal[0]) - **返回** - - str **2.** `(group, /) -> str | Any` - - **参数** - - `group` (str | int) - **返回** - - str | Any **3.** `(group1, group2, /, *groups) -> tuple[str | Any, ...]` - - **参数** - - `group1` (str | int) - `group2` (str | int) @@ -422,7 +384,6 @@ description: nonebot.params 模块 - `*groups` (str | int) - **返回** - - tuple[str | Any, ...] ## _def_ `RegexGroup()` {#RegexGroup} @@ -434,7 +395,6 @@ description: nonebot.params 模块 empty - **返回** - - tuple[Any, ...] ## _def_ `RegexDict()` {#RegexDict} @@ -446,7 +406,6 @@ description: nonebot.params 模块 empty - **返回** - - dict[str, Any] ## _def_ `Startswith()` {#Startswith} @@ -458,7 +417,6 @@ description: nonebot.params 模块 empty - **返回** - - str ## _def_ `Endswith()` {#Endswith} @@ -470,7 +428,6 @@ description: nonebot.params 模块 empty - **返回** - - str ## _def_ `Fullmatch()` {#Fullmatch} @@ -482,7 +439,6 @@ description: nonebot.params 模块 empty - **返回** - - str ## _def_ `Keyword()` {#Keyword} @@ -494,7 +450,6 @@ description: nonebot.params 模块 empty - **返回** - - str ## _def_ `Received(id=None, default=None)` {#Received} @@ -502,13 +457,11 @@ description: nonebot.params 模块 - **说明:** `receive` 事件参数 - **参数** - - `id` (str | None) - `default` (Any) - **返回** - - Any ## _def_ `LastReceived(default=None)` {#LastReceived} @@ -516,11 +469,9 @@ description: nonebot.params 模块 - **说明:** `last_receive` 事件参数 - **参数** - - `default` (Any) - **返回** - - Any ## _def_ `ReceivePromptResult(id=None)` {#ReceivePromptResult} @@ -528,11 +479,9 @@ description: nonebot.params 模块 - **说明:** `receive` prompt 发送结果 - **参数** - - `id` (str | None) - **返回** - - Any ## _def_ `PausePromptResult()` {#PausePromptResult} @@ -544,5 +493,4 @@ description: nonebot.params 模块 empty - **返回** - - Any diff --git a/website/versioned_docs/version-2.4.3/api/permission.md b/website/versioned_docs/version-2.4.3/api/permission.md index a5df96c9..ac4775a8 100644 --- a/website/versioned_docs/version-2.4.3/api/permission.md +++ b/website/versioned_docs/version-2.4.3/api/permission.md @@ -22,7 +22,6 @@ description: nonebot.permission 模块 如果 `perm` 中仅有 `User` 类型的权限检查函数,则会去除原有检查函数的会话 ID 限制。 - **参数** - - `*users` (str) - `perm` (Permission | None): 需要同时满足的权限 @@ -30,7 +29,6 @@ description: nonebot.permission 模块 - `user`: 会话白名单 - **返回** - - untyped ## _class_ `Permission(*checkers)` {#Permission} @@ -42,7 +40,6 @@ description: nonebot.permission 模块 当事件传递时,在 [Matcher](matcher.md#Matcher) 运行前进行检查。 - **参数** - - `*checkers` ([T_PermissionChecker](typing.md#T-PermissionChecker) | [Dependent](dependencies/index.md#Dependent)[bool]): PermissionChecker - **用法** @@ -64,7 +61,6 @@ description: nonebot.permission 模块 - **说明:** 检查是否满足某个权限。 - **参数** - - `bot` ([Bot](adapters/index.md#Bot)): Bot 对象 - `event` ([Event](adapters/index.md#Event)): Event 对象 @@ -74,7 +70,6 @@ description: nonebot.permission 模块 - `dependency_cache` ([T_DependencyCache](typing.md#T-DependencyCache) | None): 依赖缓存 - **返回** - - bool ## _class_ `User(users, perm=None)` {#User} @@ -82,7 +77,6 @@ description: nonebot.permission 模块 - **说明:** 检查当前事件是否属于指定会话。 - **参数** - - `users` (tuple[str, ...]): 会话 ID 元组 - `perm` (Permission | None): 需同时满足的权限 @@ -96,13 +90,11 @@ description: nonebot.permission 模块 如果 `perm` 中仅有 `User` 类型的权限检查函数,则会去除原有的会话 ID 限制。 - **参数** - - `event` ([Event](adapters/index.md#Event)): Event 对象 - `perm` (Permission | None): 需同时满足的权限 - **返回** - - Self ### _classmethod_ `from_permission(*users, perm=None)` {#User-from-permission} @@ -114,13 +106,11 @@ description: nonebot.permission 模块 如果 `perm` 中仅有 `User` 类型的权限检查函数,则会去除原有的会话 ID 限制。 - **参数** - - `*users` (str): 会话白名单 - `perm` (Permission | None): 需同时满足的权限 - **返回** - - Self ## _class_ `Message()` {#Message} diff --git a/website/versioned_docs/version-2.4.3/api/plugin/index.md b/website/versioned_docs/version-2.4.3/api/plugin/index.md index 68c66d99..66acdfbb 100644 --- a/website/versioned_docs/version-2.4.3/api/plugin/index.md +++ b/website/versioned_docs/version-2.4.3/api/plugin/index.md @@ -51,11 +51,9 @@ description: nonebot.plugin 模块 如果为嵌套的子插件,标识符为 `父插件标识符:子插件文件(夹)名`。 - **参数** - - `plugin_id` (str): 插件标识符,即 [Plugin.id\_](model.md#Plugin-id-)。 - **返回** - - [Plugin](model.md#Plugin) | None ## _def_ `get_plugin_by_module_name(module_name)` {#get-plugin-by-module-name} @@ -67,11 +65,9 @@ description: nonebot.plugin 模块 如果提供的模块名为某个插件的子模块,同样会返回该插件。 - **参数** - - `module_name` (str): 模块名,即 [Plugin.module_name](model.md#Plugin-module-name)。 - **返回** - - [Plugin](model.md#Plugin) | None ## _def_ `get_loaded_plugins()` {#get-loaded-plugins} @@ -83,7 +79,6 @@ description: nonebot.plugin 模块 empty - **返回** - - set[[Plugin](model.md#Plugin)] ## _def_ `get_available_plugin_names()` {#get-available-plugin-names} @@ -95,7 +90,6 @@ description: nonebot.plugin 模块 empty - **返回** - - set[str] ## _def_ `get_plugin_config(config)` {#get-plugin-config} @@ -103,9 +97,7 @@ description: nonebot.plugin 模块 - **说明:** 从全局配置获取当前插件需要的配置项。 - **参数** - - `config` (type[C]) - **返回** - - C diff --git a/website/versioned_docs/version-2.4.3/api/plugin/load.md b/website/versioned_docs/version-2.4.3/api/plugin/load.md index 5c2a5a12..0fb7328f 100644 --- a/website/versioned_docs/version-2.4.3/api/plugin/load.md +++ b/website/versioned_docs/version-2.4.3/api/plugin/load.md @@ -14,11 +14,9 @@ description: nonebot.plugin.load 模块 - **说明:** 加载单个插件,可以是本地插件或是通过 `pip` 安装的插件。 - **参数** - - `module_path` (str | Path): 插件名称 `path.to.your.plugin` 或插件路径 `pathlib.Path(path/to/your/plugin)` - **返回** - - [Plugin](model.md#Plugin) | None ## _def_ `load_plugins(*plugin_dir)` {#load-plugins} @@ -26,11 +24,9 @@ description: nonebot.plugin.load 模块 - **说明:** 导入文件夹下多个插件,以 `_` 开头的插件不会被导入! - **参数** - - `*plugin_dir` (str): 文件夹路径 - **返回** - - set[[Plugin](model.md#Plugin)] ## _def_ `load_all_plugins(module_path, plugin_dir)` {#load-all-plugins} @@ -38,13 +34,11 @@ description: nonebot.plugin.load 模块 - **说明:** 导入指定列表中的插件以及指定目录下多个插件,以 `_` 开头的插件不会被导入! - **参数** - - `module_path` (Iterable[str]): 指定插件集合 - `plugin_dir` (Iterable[str]): 指定文件夹路径集合 - **返回** - - set[[Plugin](model.md#Plugin)] ## _def_ `load_from_json(file_path, encoding="utf-8")` {#load-from-json} @@ -52,13 +46,11 @@ description: nonebot.plugin.load 模块 - **说明:** 导入指定 json 文件中的 `plugins` 以及 `plugin_dirs` 下多个插件。 以 `_` 开头的插件不会被导入! - **参数** - - `file_path` (str): 指定 json 文件路径 - `encoding` (str): 指定 json 文件编码 - **返回** - - set[[Plugin](model.md#Plugin)] - **用法** @@ -79,13 +71,11 @@ description: nonebot.plugin.load 模块 - **说明:** 导入指定 toml 文件 `[tool.nonebot]` 中的 `plugins` 以及 `plugin_dirs` 下多个插件。 以 `_` 开头的插件不会被导入! - **参数** - - `file_path` (str): 指定 toml 文件路径 - `encoding` (str): 指定 toml 文件编码 - **返回** - - set[[Plugin](model.md#Plugin)] - **用法** @@ -105,11 +95,9 @@ description: nonebot.plugin.load 模块 - **说明:** 导入 NoneBot 内置插件。 - **参数** - - `name` (str): 插件名称 - **返回** - - [Plugin](model.md#Plugin) | None ## _def_ `load_builtin_plugins(*plugins)` {#load-builtin-plugins} @@ -117,11 +105,9 @@ description: nonebot.plugin.load 模块 - **说明:** 导入多个 NoneBot 内置插件。 - **参数** - - `*plugins` (str): 插件名称列表 - **返回** - - set[[Plugin](model.md#Plugin)] ## _def_ `require(name)` {#require} @@ -129,15 +115,12 @@ description: nonebot.plugin.load 模块 - **说明:** 声明依赖插件。 - **参数** - - `name` (str): 插件模块名或插件标识符,仅在已声明插件的情况下可使用标识符。 - **返回** - - ModuleType - **异常** - - RuntimeError: 插件无法加载 ## _def_ `inherit_supported_adapters(*names)` {#inherit-supported-adapters} @@ -149,15 +132,12 @@ description: nonebot.plugin.load 模块 如果传入了多个插件名称,返回值会自动取交集。 - **参数** - - `*names` (str): 插件名称列表。 - **返回** - - set[str] | None - **异常** - - RuntimeError: 插件未加载 - ValueError: 插件缺少元数据 diff --git a/website/versioned_docs/version-2.4.3/api/plugin/manager.md b/website/versioned_docs/version-2.4.3/api/plugin/manager.md index af32a84b..f9cc1da5 100644 --- a/website/versioned_docs/version-2.4.3/api/plugin/manager.md +++ b/website/versioned_docs/version-2.4.3/api/plugin/manager.md @@ -16,7 +16,6 @@ description: nonebot.plugin.manager 模块 - **说明:** 插件管理器。 - **参数** - - `plugins` (Iterable[str] | None): 独立插件模块名集合。 - `search_path` (Iterable[str] | None): 插件搜索路径(文件夹),相对于当前工作目录。 @@ -54,11 +53,9 @@ description: nonebot.plugin.manager 模块 可以使用完整插件模块名或者插件标识符加载。 - **参数** - - `name` (str): 插件名称或插件标识符。 - **返回** - - [Plugin](model.md#Plugin) | None ### _method_ `load_all_plugins()` {#PluginManager-load-all-plugins} @@ -70,7 +67,6 @@ description: nonebot.plugin.manager 模块 empty - **返回** - - set[[Plugin](model.md#Plugin)] ## _class_ `PluginFinder()` {#PluginFinder} @@ -82,7 +78,6 @@ description: nonebot.plugin.manager 模块 ### _method_ `find_spec(fullname, path, target=None)` {#PluginFinder-find-spec} - **参数** - - `fullname` (str) - `path` (Sequence[str] | None) @@ -90,13 +85,11 @@ description: nonebot.plugin.manager 模块 - `target` (ModuleType | None) - **返回** - - untyped ## _class_ `PluginLoader(manager, fullname, path)` {#PluginLoader} - **参数** - - `manager` (PluginManager) - `fullname` (str) @@ -106,19 +99,15 @@ description: nonebot.plugin.manager 模块 ### _method_ `create_module(spec)` {#PluginLoader-create-module} - **参数** - - `spec` - **返回** - - ModuleType | None ### _method_ `exec_module(module)` {#PluginLoader-exec-module} - **参数** - - `module` (ModuleType) - **返回** - - None diff --git a/website/versioned_docs/version-2.4.3/api/plugin/model.md b/website/versioned_docs/version-2.4.3/api/plugin/model.md index 02824975..d58e67cc 100644 --- a/website/versioned_docs/version-2.4.3/api/plugin/model.md +++ b/website/versioned_docs/version-2.4.3/api/plugin/model.md @@ -80,7 +80,6 @@ description: nonebot.plugin.model 模块 empty - **返回** - - set[type[[Adapter](../adapters/index.md#Adapter)]] | None ## _class_ `Plugin()` {#Plugin} diff --git a/website/versioned_docs/version-2.4.3/api/plugin/on.md b/website/versioned_docs/version-2.4.3/api/plugin/on.md index 638bacaa..06bb3b20 100644 --- a/website/versioned_docs/version-2.4.3/api/plugin/on.md +++ b/website/versioned_docs/version-2.4.3/api/plugin/on.md @@ -14,11 +14,9 @@ description: nonebot.plugin.on 模块 - **说明:** 存储一个事件响应器到插件。 - **参数** - - `matcher` (type[[Matcher](../matcher.md#Matcher)]): 事件响应器 - **返回** - - None ## _def_ `get_matcher_plugin(depth=...)` {#get-matcher-plugin} @@ -30,11 +28,9 @@ description: nonebot.plugin.on 模块 **Deprecated**, 请使用 [get_matcher_source](#get-matcher-source) 获取信息。 - **参数** - - `depth` (int): 调用栈深度 - **返回** - - [Plugin](model.md#Plugin) | None ## _def_ `get_matcher_module(depth=...)` {#get-matcher-module} @@ -46,11 +42,9 @@ description: nonebot.plugin.on 模块 **Deprecated**, 请使用 [get_matcher_source](#get-matcher-source) 获取信息。 - **参数** - - `depth` (int): 调用栈深度 - **返回** - - ModuleType | None ## _def_ `get_matcher_source(depth=...)` {#get-matcher-source} @@ -58,11 +52,9 @@ description: nonebot.plugin.on 模块 - **说明:** 获取事件响应器定义所在源码信息。 - **参数** - - `depth` (int): 调用栈深度 - **返回** - - MatcherSource | None ## _def_ `on(type="", rule=..., permission=..., *, handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on} @@ -70,7 +62,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个基础事件响应器,可自定义类型。 - **参数** - - `type` (str): 事件响应器类型 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -90,7 +81,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_metaevent(rule=..., permission=..., *, handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-metaevent} @@ -98,7 +88,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个元事件响应器。 - **参数** - - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 - `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限 @@ -116,7 +105,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_message(rule=..., permission=..., *, handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-message} @@ -124,7 +112,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个消息事件响应器。 - **参数** - - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 - `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限 @@ -142,7 +129,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_notice(rule=..., permission=..., *, handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-notice} @@ -150,7 +136,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个通知事件响应器。 - **参数** - - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 - `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限 @@ -168,7 +153,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_request(rule=..., permission=..., *, handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-request} @@ -176,7 +160,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个请求事件响应器。 - **参数** - - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 - `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限 @@ -194,7 +177,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_startswith(msg, rule=..., ignorecase=..., *, permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-startswith} @@ -202,7 +184,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个消息事件响应器,并且当消息的**文本部分**以指定内容开头时响应。 - **参数** - - `msg` (str | tuple[str, ...]): 指定消息开头内容 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -224,7 +205,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_endswith(msg, rule=..., ignorecase=..., *, permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-endswith} @@ -232,7 +212,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个消息事件响应器,并且当消息的**文本部分**以指定内容结尾时响应。 - **参数** - - `msg` (str | tuple[str, ...]): 指定消息结尾内容 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -254,7 +233,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_fullmatch(msg, rule=..., ignorecase=..., *, permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-fullmatch} @@ -262,7 +240,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个消息事件响应器,并且当消息的**文本部分**与指定内容完全一致时响应。 - **参数** - - `msg` (str | tuple[str, ...]): 指定消息全匹配内容 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -284,7 +261,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_keyword(keywords, rule=..., *, permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-keyword} @@ -292,7 +268,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个消息事件响应器,并且当消息纯文本部分包含关键词时响应。 - **参数** - - `keywords` (set[str]): 关键词列表 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -312,7 +287,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_command(cmd, rule=..., aliases=..., force_whitespace=..., *, permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-command} @@ -324,7 +298,6 @@ description: nonebot.plugin.on 模块 命令匹配规则参考: `命令形式匹配 `\_ - **参数** - - `cmd` (str | tuple[str, ...]): 指定命令内容 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -348,7 +321,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_shell_command(cmd, rule=..., aliases=..., parser=..., *, permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-shell-command} @@ -363,7 +335,6 @@ description: nonebot.plugin.on 模块 通过 [ShellCommandArgs](../params.md#ShellCommandArgs) 获取解析后的参数字典。 - **参数** - - `cmd` (str | tuple[str, ...]): 指定命令内容 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -387,7 +358,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_regex(pattern, flags=..., rule=..., *, permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-regex} @@ -399,7 +369,6 @@ description: nonebot.plugin.on 模块 命令匹配规则参考: `正则匹配 `\_ - **参数** - - `pattern` (str): 正则表达式 - `flags` (int | re.RegexFlag): 正则匹配标志 @@ -421,7 +390,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _def_ `on_type(types, rule=..., *, permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#on-type} @@ -429,7 +397,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个事件响应器,并且当事件为指定类型时响应。 - **参数** - - `types` (type[[Event](../adapters/index.md#Event)] | tuple[type[[Event](../adapters/index.md#Event)], ...]): 事件类型 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -449,13 +416,11 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _class_ `CommandGroup(cmd, prefix_aliases=..., *, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#CommandGroup} - **参数** - - `cmd` (str | tuple[str, ...]) - `prefix_aliases` (bool) @@ -481,7 +446,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个新的命令。新参数将会覆盖命令组默认值 - **参数** - - `cmd` (str | tuple[str, ...]): 指定命令内容 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -505,7 +469,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `shell_command(cmd, *, rule=..., aliases=..., parser=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#CommandGroup-shell-command} @@ -513,7 +476,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个新的 `shell_like` 命令。新参数将会覆盖命令组默认值 - **参数** - - `cmd` (str | tuple[str, ...]): 指定命令内容 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -537,13 +499,11 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ## _class_ `MatcherGroup(*, type=..., rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup} - **参数** - - `type` (str) - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None) @@ -567,7 +527,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个基础事件响应器,可自定义类型。 - **参数** - - `type` (str): 事件响应器类型 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -587,7 +546,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_metaevent(*, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-metaevent} @@ -595,7 +553,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个元事件响应器。 - **参数** - - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 - `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限 @@ -613,7 +570,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_message(*, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-message} @@ -621,7 +577,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个消息事件响应器。 - **参数** - - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 - `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限 @@ -639,7 +594,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_notice(*, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-notice} @@ -647,7 +601,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个通知事件响应器。 - **参数** - - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 - `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限 @@ -665,7 +618,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_request(*, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-request} @@ -673,7 +625,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个请求事件响应器。 - **参数** - - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 - `permission` ([Permission](../permission.md#Permission) | [T_PermissionChecker](../typing.md#T-PermissionChecker) | None): 事件响应权限 @@ -691,7 +642,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_startswith(msg, *, ignorecase=..., rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-startswith} @@ -699,7 +649,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个消息事件响应器,并且当消息的**文本部分**以指定内容开头时响应。 - **参数** - - `msg` (str | tuple[str, ...]): 指定消息开头内容 - `ignorecase` (bool): 是否忽略大小写 @@ -721,7 +670,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_endswith(msg, *, ignorecase=..., rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-endswith} @@ -729,7 +677,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个消息事件响应器,并且当消息的**文本部分**以指定内容结尾时响应。 - **参数** - - `msg` (str | tuple[str, ...]): 指定消息结尾内容 - `ignorecase` (bool): 是否忽略大小写 @@ -751,7 +698,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_fullmatch(msg, *, ignorecase=..., rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-fullmatch} @@ -759,7 +705,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个消息事件响应器,并且当消息的**文本部分**与指定内容完全一致时响应。 - **参数** - - `msg` (str | tuple[str, ...]): 指定消息全匹配内容 - `ignorecase` (bool): 是否忽略大小写 @@ -781,7 +726,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_keyword(keywords, *, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-keyword} @@ -789,7 +733,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个消息事件响应器,并且当消息纯文本部分包含关键词时响应。 - **参数** - - `keywords` (set[str]): 关键词列表 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -809,7 +752,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_command(cmd, aliases=..., force_whitespace=..., *, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-command} @@ -821,7 +763,6 @@ description: nonebot.plugin.on 模块 命令匹配规则参考: `命令形式匹配 `\_ - **参数** - - `cmd` (str | tuple[str, ...]): 指定命令内容 - `aliases` (set[str | tuple[str, ...]] | None): 命令别名 @@ -845,7 +786,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_shell_command(cmd, aliases=..., parser=..., *, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-shell-command} @@ -860,7 +800,6 @@ description: nonebot.plugin.on 模块 通过 [ShellCommandArgs](../params.md#ShellCommandArgs) 获取解析后的参数字典。 - **参数** - - `cmd` (str | tuple[str, ...]): 指定命令内容 - `aliases` (set[str | tuple[str, ...]] | None): 命令别名 @@ -884,7 +823,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_regex(pattern, flags=..., *, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-regex} @@ -896,7 +834,6 @@ description: nonebot.plugin.on 模块 命令匹配规则参考: `正则匹配 `\_ - **参数** - - `pattern` (str): 正则表达式 - `flags` (int | re.RegexFlag): 正则匹配标志 @@ -918,7 +855,6 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] ### _method_ `on_type(types, *, rule=..., permission=..., handlers=..., temp=..., expire_time=..., priority=..., block=..., state=...)` {#MatcherGroup-on-type} @@ -926,7 +862,6 @@ description: nonebot.plugin.on 模块 - **说明:** 注册一个事件响应器,并且当事件为指定类型时响应。 - **参数** - - `types` (type[[Event](../adapters/index.md#Event)] | tuple[type[[Event](../adapters/index.md#Event)]]): 事件类型 - `rule` ([Rule](../rule.md#Rule) | [T_RuleChecker](../typing.md#T-RuleChecker) | None): 事件响应规则 @@ -946,5 +881,4 @@ description: nonebot.plugin.on 模块 - `state` ([T_State](../typing.md#T-State) | None): 默认 state - **返回** - - type[[Matcher](../matcher.md#Matcher)] diff --git a/website/versioned_docs/version-2.4.3/api/rule.md b/website/versioned_docs/version-2.4.3/api/rule.md index 3307b13f..23b90248 100644 --- a/website/versioned_docs/version-2.4.3/api/rule.md +++ b/website/versioned_docs/version-2.4.3/api/rule.md @@ -22,7 +22,6 @@ description: nonebot.rule 模块 当事件传递时,在 [Matcher](matcher.md#Matcher) 运行前进行检查。 - **参数** - - `*checkers` ([T_RuleChecker](typing.md#T-RuleChecker) | [Dependent](dependencies/index.md#Dependent)[bool]): RuleChecker - **用法** @@ -44,7 +43,6 @@ description: nonebot.rule 模块 - **说明:** 检查是否符合所有规则 - **参数** - - `bot` ([Bot](adapters/index.md#Bot)): Bot 对象 - `event` ([Event](adapters/index.md#Event)): Event 对象 @@ -56,7 +54,6 @@ description: nonebot.rule 模块 - `dependency_cache` ([T_DependencyCache](typing.md#T-DependencyCache) | None): 依赖缓存 - **返回** - - bool ## _class_ `CMD_RESULT()` {#CMD-RESULT} @@ -78,7 +75,6 @@ description: nonebot.rule 模块 - **说明:** 检查消息纯文本是否以指定字符串开头。 - **参数** - - `msg` (tuple[str, ...]): 指定消息开头字符串元组 - `ignorecase` (bool): 是否忽略大小写 @@ -88,13 +84,11 @@ description: nonebot.rule 模块 - **说明:** 匹配消息纯文本开头。 - **参数** - - `msg` (str | tuple[str, ...]): 指定消息开头字符串元组 - `ignorecase` (bool): 是否忽略大小写 - **返回** - - [Rule](#Rule) ## _class_ `EndswithRule(msg, ignorecase=False)` {#EndswithRule} @@ -102,7 +96,6 @@ description: nonebot.rule 模块 - **说明:** 检查消息纯文本是否以指定字符串结尾。 - **参数** - - `msg` (tuple[str, ...]): 指定消息结尾字符串元组 - `ignorecase` (bool): 是否忽略大小写 @@ -112,13 +105,11 @@ description: nonebot.rule 模块 - **说明:** 匹配消息纯文本结尾。 - **参数** - - `msg` (str | tuple[str, ...]): 指定消息开头字符串元组 - `ignorecase` (bool): 是否忽略大小写 - **返回** - - [Rule](#Rule) ## _class_ `FullmatchRule(msg, ignorecase=False)` {#FullmatchRule} @@ -126,7 +117,6 @@ description: nonebot.rule 模块 - **说明:** 检查消息纯文本是否与指定字符串全匹配。 - **参数** - - `msg` (tuple[str, ...]): 指定消息全匹配字符串元组 - `ignorecase` (bool): 是否忽略大小写 @@ -136,13 +126,11 @@ description: nonebot.rule 模块 - **说明:** 完全匹配消息。 - **参数** - - `msg` (str | tuple[str, ...]): 指定消息全匹配字符串元组 - `ignorecase` (bool): 是否忽略大小写 - **返回** - - [Rule](#Rule) ## _class_ `KeywordsRule(*keywords)` {#KeywordsRule} @@ -150,7 +138,6 @@ description: nonebot.rule 模块 - **说明:** 检查消息纯文本是否包含指定关键字。 - **参数** - - `*keywords` (str): 指定关键字元组 ## _def_ `keyword(*keywords)` {#keyword} @@ -158,11 +145,9 @@ description: nonebot.rule 模块 - **说明:** 匹配消息纯文本关键词。 - **参数** - - `*keywords` (str): 指定关键字元组 - **返回** - - [Rule](#Rule) ## _class_ `CommandRule(cmds, force_whitespace=None)` {#CommandRule} @@ -170,7 +155,6 @@ description: nonebot.rule 模块 - **说明:** 检查消息是否为指定命令。 - **参数** - - `cmds` (list[tuple[str, ...]]): 指定命令元组列表 - `force_whitespace` (str | bool | None): 是否强制命令后必须有指定空白符 @@ -189,13 +173,11 @@ description: nonebot.rule 模块 通过 [CommandArg](params.md#CommandArg) 获取匹配成功的命令参数。 - **参数** - - `*cmds` (str | tuple[str, ...]): 命令文本或命令元组 - `force_whitespace` (str | bool | None): 是否强制命令后必须有指定空白符 - **返回** - - [Rule](#Rule) - **用法** @@ -231,37 +213,28 @@ description: nonebot.rule 模块 - **重载** **1.** `(args=None, namespace=None) -> tuple[Namespace, list[str | MessageSegment]]` - - **参数** - - `args` (Sequence[str | [MessageSegment](adapters/index.md#MessageSegment)] | None) - `namespace` (None) - **返回** - - tuple[Namespace, list[str | [MessageSegment](adapters/index.md#MessageSegment)]] **2.** `(args, namespace) -> tuple[T, list[str | MessageSegment]]` - - **参数** - - `args` (Sequence[str | [MessageSegment](adapters/index.md#MessageSegment)] | None) - `namespace` (T) - **返回** - - tuple[T, list[str | [MessageSegment](adapters/index.md#MessageSegment)]] **3.** `(*, namespace) -> tuple[T, list[str | MessageSegment]]` - - **参数** - - `namespace` (T) - **返回** - - tuple[T, list[str | [MessageSegment](adapters/index.md#MessageSegment)]] ## _class_ `ShellCommandRule(cmds, parser)` {#ShellCommandRule} @@ -269,7 +242,6 @@ description: nonebot.rule 模块 - **说明:** 检查消息是否为指定 shell 命令。 - **参数** - - `cmds` (list[tuple[str, ...]]): 指定命令元组列表 - `parser` (ArgumentParser | None): 可选参数解析器 @@ -298,13 +270,11 @@ description: nonebot.rule 模块 ::: - **参数** - - `*cmds` (str | tuple[str, ...]): 命令文本或命令元组 - `parser` (ArgumentParser | None): [ArgumentParser](#ArgumentParser) 对象 - **返回** - - [Rule](#Rule) - **用法** @@ -330,7 +300,6 @@ description: nonebot.rule 模块 - **说明:** 检查消息字符串是否符合指定正则表达式。 - **参数** - - `regex` (str): 正则表达式 - `flags` (int): 正则表达式标记 @@ -346,13 +315,11 @@ description: nonebot.rule 模块 通过 [RegexDict](params.md#RegexDict) 获取匹配成功的 group 字典。 - **参数** - - `regex` (str): 正则表达式 - `flags` (int | re.RegexFlag): 正则表达式标记 - **返回** - - [Rule](#Rule) :::tip 提示 @@ -380,7 +347,6 @@ description: nonebot.rule 模块 empty - **返回** - - [Rule](#Rule) ## _class_ `IsTypeRule(*types)` {#IsTypeRule} @@ -388,7 +354,6 @@ description: nonebot.rule 模块 - **说明:** 检查事件类型是否为指定类型。 - **参数** - - `*types` (type[[Event](adapters/index.md#Event)]) ## _def_ `is_type(*types)` {#is-type} @@ -396,9 +361,7 @@ description: nonebot.rule 模块 - **说明:** 匹配事件类型。 - **参数** - - `*types` (type[[Event](adapters/index.md#Event)]): 事件类型 - **返回** - - [Rule](#Rule) diff --git a/website/versioned_docs/version-2.4.3/api/typing.md b/website/versioned_docs/version-2.4.3/api/typing.md index 689b0810..904469ef 100644 --- a/website/versioned_docs/version-2.4.3/api/typing.md +++ b/website/versioned_docs/version-2.4.3/api/typing.md @@ -19,31 +19,25 @@ description: nonebot.typing 模块 - **说明:** 标记一个方法为父类 interface 的 implement - **参数** - - `InterfaceClass` (object) - **返回** - - untyped ## _def_ `type_has_args(type_)` {#type-has-args} - **参数** - - `type_` (type[Any]) - **返回** - - bool ## _def_ `origin_is_union(origin)` {#origin-is-union} - **参数** - - `origin` (type[Any] | None) - **返回** - - bool ## _def_ `origin_is_literal(origin)` {#origin-is-literal} @@ -51,11 +45,9 @@ description: nonebot.typing 模块 - **说明:** 判断是否是 Literal 类型 - **参数** - - `origin` (type[Any] | None) - **返回** - - bool ## _def_ `all_literal_values(type_)` {#all-literal-values} @@ -63,11 +55,9 @@ description: nonebot.typing 模块 - **说明:** 获取 Literal 类型包含的所有值 - **参数** - - `type_` (type[Any]) - **返回** - - list[Any] ## _def_ `origin_is_annotated(origin)` {#origin-is-annotated} @@ -75,11 +65,9 @@ description: nonebot.typing 模块 - **说明:** 判断是否是 Annotated 类型 - **参数** - - `origin` (type[Any] | None) - **返回** - - bool ## _def_ `is_none_type(type_)` {#is-none-type} @@ -87,27 +75,22 @@ description: nonebot.typing 模块 - **说明:** 判断是否是 None 类型 - **参数** - - `type_` (type[Any]) - **返回** - - bool ## _def_ `is_type_alias_type(type_)` {#is-type-alias-type} - **参数** - - `type_` (type[Any]) - **返回** - - bool ## _def_ `evaluate_forwardref(ref, globalns, localns)` {#evaluate-forwardref} - **参数** - - `ref` (ForwardRef) - `globalns` (dict[str, Any]) @@ -115,7 +98,6 @@ description: nonebot.typing 模块 - `localns` (dict[str, Any]) - **返回** - - Any ## _class_ `StateFlag()` {#StateFlag} @@ -139,7 +121,6 @@ description: nonebot.typing 模块 Bot 连接建立时钩子函数 依赖参数: - - DependParam: 子依赖参数 - BotParam: Bot 对象 - DefaultParam: 带有默认值的参数 @@ -153,7 +134,6 @@ description: nonebot.typing 模块 Bot 连接断开时钩子函数 依赖参数: - - DependParam: 子依赖参数 - BotParam: Bot 对象 - DefaultParam: 带有默认值的参数 @@ -179,7 +159,6 @@ description: nonebot.typing 模块 事件预处理函数 EventPreProcessor 类型 依赖参数: - - DependParam: 子依赖参数 - BotParam: Bot 对象 - EventParam: Event 对象 @@ -195,7 +174,6 @@ description: nonebot.typing 模块 事件后处理函数 EventPostProcessor 类型 依赖参数: - - DependParam: 子依赖参数 - BotParam: Bot 对象 - EventParam: Event 对象 @@ -211,7 +189,6 @@ description: nonebot.typing 模块 事件响应器运行前预处理函数 RunPreProcessor 类型 依赖参数: - - DependParam: 子依赖参数 - BotParam: Bot 对象 - EventParam: Event 对象 @@ -228,7 +205,6 @@ description: nonebot.typing 模块 事件响应器运行后后处理函数 RunPostProcessor 类型 依赖参数: - - DependParam: 子依赖参数 - BotParam: Bot 对象 - EventParam: Event 对象 @@ -246,7 +222,6 @@ description: nonebot.typing 模块 RuleChecker 即判断是否响应事件的处理函数。 依赖参数: - - DependParam: 子依赖参数 - BotParam: Bot 对象 - EventParam: Event 对象 @@ -262,7 +237,6 @@ description: nonebot.typing 模块 PermissionChecker 即判断事件是否满足权限的处理函数。 依赖参数: - - DependParam: 子依赖参数 - BotParam: Bot 对象 - EventParam: Event 对象 @@ -283,7 +257,6 @@ description: nonebot.typing 模块 TypeUpdater 在 Matcher.pause, Matcher.reject 时被运行,用于更新响应的事件类型。 默认会更新为 `message`。 依赖参数: - - DependParam: 子依赖参数 - BotParam: Bot 对象 - EventParam: Event 对象 @@ -300,7 +273,6 @@ description: nonebot.typing 模块 PermissionUpdater 在 Matcher.pause, Matcher.reject 时被运行,用于更新会话对象权限。 默认会更新为当前事件的触发对象。 依赖参数: - - DependParam: 子依赖参数 - BotParam: Bot 对象 - EventParam: Event 对象 diff --git a/website/versioned_docs/version-2.4.3/api/utils.md b/website/versioned_docs/version-2.4.3/api/utils.md index 53128b24..dd752cbf 100644 --- a/website/versioned_docs/version-2.4.3/api/utils.md +++ b/website/versioned_docs/version-2.4.3/api/utils.md @@ -18,11 +18,9 @@ description: nonebot.utils 模块 参考: [loguru color 标签](https://loguru.readthedocs.io/en/stable/api/logger.html#color) - **参数** - - `s` (str): 需要转义的字符串 - **返回** - - str ## _def_ `deep_update(mapping, *updating_mappings)` {#deep-update} @@ -30,13 +28,11 @@ description: nonebot.utils 模块 - **说明:** 深度更新合并字典 - **参数** - - `mapping` (dict[K, Any]) - `*updating_mappings` (dict[K, Any]) - **返回** - - dict[K, Any] ## _def_ `lenient_issubclass(cls, class_or_tuple)` {#lenient-issubclass} @@ -44,13 +40,11 @@ description: nonebot.utils 模块 - **说明:** 检查 cls 是否是 class_or_tuple 中的一个类型子类并忽略类型错误。 - **参数** - - `cls` (Any) - `class_or_tuple` (type[Any] | tuple[type[Any], ...]) - **返回** - - bool ## _def_ `generic_check_issubclass(cls, class_or_tuple)` {#generic-check-issubclass} @@ -60,7 +54,6 @@ description: nonebot.utils 模块 检查 cls 是否是 class_or_tuple 中的一个类型子类。 特别的: - - 如果 cls 是 `typing.TypeVar` 类型, 则会检查其 `__bound__` 或 `__constraints__` 是否是 class_or_tuple 中一个类型的子类或 None。 @@ -72,13 +65,11 @@ description: nonebot.utils 模块 则会检查其原始类型是否是 class_or_tuple 中一个类型的子类。 - **参数** - - `cls` (Any) - `class_or_tuple` (type[Any] | tuple[type[Any], ...]) - **返回** - - bool ## _def_ `type_is_complex(type_)` {#type-is-complex} @@ -86,11 +77,9 @@ description: nonebot.utils 模块 - **说明:** 检查 type\_ 是否是复杂类型 - **参数** - - `type_` (type[Any]) - **返回** - - bool ## _def_ `is_coroutine_callable(call)` {#is-coroutine-callable} @@ -98,11 +87,9 @@ description: nonebot.utils 模块 - **说明:** 检查 call 是否是一个 callable 协程函数 - **参数** - - `call` ((...) -> Any) - **返回** - - bool ## _def_ `is_gen_callable(call)` {#is-gen-callable} @@ -110,11 +97,9 @@ description: nonebot.utils 模块 - **说明:** 检查 call 是否是一个生成器函数 - **参数** - - `call` ((...) -> Any) - **返回** - - bool ## _def_ `is_async_gen_callable(call)` {#is-async-gen-callable} @@ -122,11 +107,9 @@ description: nonebot.utils 模块 - **说明:** 检查 call 是否是一个异步生成器函数 - **参数** - - `call` ((...) -> Any) - **返回** - - bool ## _def_ `run_sync(call)` {#run-sync} @@ -134,11 +117,9 @@ description: nonebot.utils 模块 - **说明:** 一个用于包装 sync function 为 async function 的装饰器 - **参数** - - `call` ((P) -> R): 被装饰的同步函数 - **返回** - - (P) -> Coroutine[None, None, R] ## _def_ `run_sync_ctx_manager(cm)` {#run-sync-ctx-manager} @@ -146,11 +127,9 @@ description: nonebot.utils 模块 - **说明:** 一个用于包装 sync context manager 为 async context manager 的执行函数 - **参数** - - `cm` (AbstractContextManager[T]) - **返回** - - AsyncGenerator[T, None] ## _async def_ `run_coro_with_catch(coro, exc, return_on_err=None)` {#run-coro-with-catch} @@ -160,9 +139,7 @@ description: nonebot.utils 模块 - **重载** **1.** `(coro, exc, return_on_err=None) -> T | None` - - **参数** - - `coro` (Coroutine[Any, Any, T]) - `exc` (tuple[type[Exception], ...]) @@ -170,13 +147,10 @@ description: nonebot.utils 模块 - `return_on_err` (None) - **返回** - - T | None **2.** `(coro, exc, return_on_err) -> T | R` - - **参数** - - `coro` (Coroutine[Any, Any, T]) - `exc` (tuple[type[Exception], ...]) @@ -184,11 +158,9 @@ description: nonebot.utils 模块 - `return_on_err` (R) - **返回** - - T | R - **参数** - - `coro`: 要运行的协程 - `exc`: 要捕获的异常 @@ -204,21 +176,17 @@ description: nonebot.utils 模块 - **说明:** 运行协程并在取消时屏蔽取消异常。 - **参数** - - `coro` (Coroutine[Any, Any, T]): 要运行的协程 - **返回** - - T: 协程的返回值 ## _def_ `flatten_exception_group(exc_group)` {#flatten-exception-group} - **参数** - - `exc_group` (BaseExceptionGroup[E]) - **返回** - - Generator[E, None, None] ## _def_ `get_name(obj)` {#get-name} @@ -226,11 +194,9 @@ description: nonebot.utils 模块 - **说明:** 获取对象的名称 - **参数** - - `obj` (Any) - **返回** - - str ## _def_ `path_to_module_name(path)` {#path-to-module-name} @@ -238,11 +204,9 @@ description: nonebot.utils 模块 - **说明:** 转换路径为模块名 - **参数** - - `path` (Path) - **返回** - - str ## _def_ `resolve_dot_notation(obj_str, default_attr, default_prefix=None)` {#resolve-dot-notation} @@ -250,7 +214,6 @@ description: nonebot.utils 模块 - **说明:** 解析并导入点分表示法的对象 - **参数** - - `obj_str` (str) - `default_attr` (str) @@ -258,7 +221,6 @@ description: nonebot.utils 模块 - `default_prefix` (str | None) - **返回** - - Any ## _class_ `classproperty(func)` {#classproperty} @@ -266,7 +228,6 @@ description: nonebot.utils 模块 - **说明:** 类属性装饰器 - **参数** - - `func` ((Any) -> T) ## _class_ `DataclassEncoder()` {#DataclassEncoder} @@ -280,11 +241,9 @@ description: nonebot.utils 模块 ### _method_ `default(o)` {#DataclassEncoder-default} - **参数** - - `o` - **返回** - - untyped ## _def_ `logger_wrapper(logger_name)` {#logger-wrapper} @@ -292,15 +251,12 @@ description: nonebot.utils 模块 - **说明:** 用于打印 adapter 的日志。 - **参数** - - `logger_name` (str): adapter 的名称 - **返回** - - untyped: 日志记录函数 日志记录函数的参数: - - level: 日志等级 - message: 日志信息 - exception: 异常信息 diff --git a/website/versioned_docs/version-2.4.3/best-practice/alconna/command.md b/website/versioned_docs/version-2.4.3/best-practice/alconna/command.md index e80b136d..92e6bca3 100644 --- a/website/versioned_docs/version-2.4.3/best-practice/alconna/command.md +++ b/website/versioned_docs/version-2.4.3/best-practice/alconna/command.md @@ -289,7 +289,6 @@ opt2 = Option("--foo", default=OptionResult(value=False, args={"bar": 1})) `Arparma` 有如下属性: - 调试类 - - matched: 是否匹配成功 - error_data: 解析失败时剩余的数据 - error_info: 解析失败时的异常内容 diff --git a/website/versioned_docs/version-2.4.3/best-practice/testing/behavior.mdx b/website/versioned_docs/version-2.4.3/best-practice/testing/behavior.mdx index 3203d8a8..37d55c13 100644 --- a/website/versioned_docs/version-2.4.3/best-practice/testing/behavior.mdx +++ b/website/versioned_docs/version-2.4.3/best-practice/testing/behavior.mdx @@ -155,7 +155,6 @@ async def test_example(app: App): 1. `should_call_send` 定义事件响应器预期发送的消息,即通过[事件响应器操作 send](../../appendices/session-control.mdx#send)进行的操作。`should_call_send` 有四个参数: - - `event`:回复的目标事件。 - `message`:预期的消息对象,可以是 `str`、`Message` 或 `MessageSegment`。 - `result`:send 的返回值,将会返回给插件。 @@ -164,7 +163,6 @@ async def test_example(app: App): 2. `should_call_api` 定义事件响应器预期调用的平台 API 接口,即通过[调用平台 API](../../appendices/api-calling.mdx#调用平台-api)进行的操作。`should_call_api` 有四个参数: - - `api`:API 名称。 - `data`:预期的请求数据。 - `result`:call_api 的返回值,将会返回给插件。