feat: 异步风格插件方法注册器

This commit is contained in:
RockChinQ
2024-03-20 15:09:47 +08:00
parent fa823de6b0
commit 52a7c25540
9 changed files with 210 additions and 9 deletions

View File

@@ -13,6 +13,17 @@ class BasePlugin(metaclass=abc.ABCMeta):
"""插件基类"""
host: APIHost
"""API宿主"""
ap: app.Application
"""应用程序对象"""
def __init__(self, host: APIHost):
self.host = host
async def initialize(self):
"""初始化插件"""
pass
class APIHost:
@@ -61,8 +72,10 @@ class EventContext:
"""事件编号"""
host: APIHost = None
"""API宿主"""
event: events.BaseEventModel = None
"""此次事件的对象具体类型为handler注册时指定监听的类型可查看events.py中的定义"""
__prevent_default__ = False
"""是否阻止默认行为"""