mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-16 11:00:54 +00:00
add fastapi driver, config
This commit is contained in:
26
nonebot/message.py
Normal file
26
nonebot/message.py
Normal file
@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from .log import logger
|
||||
from .event import Event
|
||||
from .matcher import matchers
|
||||
|
||||
|
||||
async def handle_message(bot, event: Event):
|
||||
# TODO: PreProcess
|
||||
|
||||
for priority in sorted(matchers.keys()):
|
||||
for index in range(len(matchers[priority])):
|
||||
Matcher = matchers[priority][index]
|
||||
if not Matcher.check_rule(event):
|
||||
continue
|
||||
|
||||
matcher = Matcher()
|
||||
if Matcher.temp:
|
||||
del matchers[priority][index]
|
||||
|
||||
try:
|
||||
await matcher.run(bot, event)
|
||||
except Exception as e:
|
||||
logger.exception(e)
|
||||
return
|
Reference in New Issue
Block a user