noneflow[bot] ac79ae2bfc
Some checks failed
Code Coverage / Test Coverage (pydantic-v1, macos-latest, 3.10) (push) Waiting to run
Code Coverage / Test Coverage (pydantic-v1, macos-latest, 3.11) (push) Waiting to run
Code Coverage / Test Coverage (pydantic-v1, macos-latest, 3.12) (push) Waiting to run
Code Coverage / Test Coverage (pydantic-v1, macos-latest, 3.9) (push) Waiting to run
Code Coverage / Test Coverage (pydantic-v1, windows-latest, 3.10) (push) Waiting to run
Code Coverage / Test Coverage (pydantic-v1, windows-latest, 3.11) (push) Waiting to run
Code Coverage / Test Coverage (pydantic-v1, windows-latest, 3.12) (push) Waiting to run
Code Coverage / Test Coverage (pydantic-v1, windows-latest, 3.9) (push) Waiting to run
Code Coverage / Test Coverage (pydantic-v2, macos-latest, 3.10) (push) Waiting to run
Code Coverage / Test Coverage (pydantic-v2, macos-latest, 3.11) (push) Waiting to run
Code Coverage / Test Coverage (pydantic-v2, macos-latest, 3.12) (push) Waiting to run
Code Coverage / Test Coverage (pydantic-v2, macos-latest, 3.9) (push) Waiting to run
Code Coverage / Test Coverage (pydantic-v2, windows-latest, 3.10) (push) Waiting to run
Code Coverage / Test Coverage (pydantic-v2, windows-latest, 3.11) (push) Waiting to run
Code Coverage / Test Coverage (pydantic-v2, windows-latest, 3.12) (push) Waiting to run
Code Coverage / Test Coverage (pydantic-v2, windows-latest, 3.9) (push) Waiting to run
Code Coverage / Test Coverage (pydantic-v1, ubuntu-latest, 3.10) (push) Failing after 1m25s
Code Coverage / Test Coverage (pydantic-v1, ubuntu-latest, 3.11) (push) Failing after 1m24s
Code Coverage / Test Coverage (pydantic-v1, ubuntu-latest, 3.12) (push) Failing after 1m30s
Code Coverage / Test Coverage (pydantic-v1, ubuntu-latest, 3.9) (push) Failing after 1m23s
Code Coverage / Test Coverage (pydantic-v2, ubuntu-latest, 3.10) (push) Failing after 1m28s
Code Coverage / Test Coverage (pydantic-v2, ubuntu-latest, 3.11) (push) Failing after 1m33s
Code Coverage / Test Coverage (pydantic-v2, ubuntu-latest, 3.12) (push) Failing after 1m22s
Code Coverage / Test Coverage (pydantic-v2, ubuntu-latest, 3.9) (push) Failing after 1m37s
Pyright Lint / Pyright Lint (pydantic-v1) (push) Failing after 1m23s
Pyright Lint / Pyright Lint (pydantic-v2) (push) Failing after 1m19s
Ruff Lint / Ruff Lint (push) Successful in 27s
Site Deploy / publish (push) Failing after 1m31s
🔖 Release 2.4.2
2025-03-12 03:56:28 +00:00

2.5 KiB

mdx sidebar_position description
format
md
2 nonebot.message 模块

nonebot.message

本模块定义了事件处理主要流程。

NoneBot 内部处理并按优先级分发事件给所有事件响应器,提供了多个插槽以进行事件的预处理等。

def event_preprocessor(func)

def event_postprocessor(func)

def run_preprocessor(func)

def run_postprocessor(func)

async def check_and_run_matcher(Matcher, bot, event, state, stack=None, dependency_cache=None)

  • 说明: 检查并运行事件响应器。

  • 参数

    • Matcher (type[Matcher]): 事件响应器

    • bot (Bot): Bot 对象

    • event (Event): Event 对象

    • state (T_State): 会话状态

    • stack (AsyncExitStack | None): 异步上下文栈

    • dependency_cache (T_DependencyCache | None): 依赖缓存

  • 返回

    • None

async def handle_event(bot, event)

  • 说明: 处理一个事件。调用该函数以实现分发事件。

  • 参数

    • bot (Bot): Bot 对象

    • event (Event): Event 对象

  • 返回

    • None
  • 用法

    driver.task_group.start_soon(handle_event, bot, event)