add fastapi driver, config

This commit is contained in:
yanyongyu
2020-07-04 22:51:10 +08:00
parent 1e632d5f10
commit 4d242875d2
16 changed files with 644 additions and 45 deletions

26
nonebot/message.py Normal file
View 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