mirror of
				https://github.com/nonebot/nonebot2.git
				synced 2025-11-04 00:46:43 +00:00 
			
		
		
		
	
		
			
				
	
	
	
		
			2.5 KiB
		
	
	
	
	
	
	
	
			
		
		
	
	
			2.5 KiB
		
	
	
	
	
	
	
	
sidebar_position, description
| sidebar_position | description | 
|---|---|
| 2 | nonebot.message 模块 | 
nonebot.message
本模块定义了事件处理主要流程。
NoneBot 内部处理并按优先级分发事件给所有事件响应器,提供了多个插槽以进行事件的预处理等。
def event_preprocessor(func)
- 
说明
事件预处理。
装饰一个函数,使它在每次接收到事件并分发给各响应器之前执行。
 - 
参数
func(T_EventPreProcessor)
 - 
返回
 
def event_postprocessor(func)
- 
说明
事件后处理。
装饰一个函数,使它在每次接收到事件并分发给各响应器之后执行。
 - 
参数
func(T_EventPostProcessor)
 - 
返回
 
def run_preprocessor(func)
- 
说明
运行预处理。
装饰一个函数,使它在每次事件响应器运行前执行。
 - 
参数
func(T_RunPreProcessor)
 - 
返回
 
def run_postprocessor(func)
- 
说明
运行后处理。
装饰一个函数,使它在每次事件响应器运行后执行。
 - 
参数
func(T_RunPostProcessor)
 - 
返回
 
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