mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-01-19 09:38:21 +08:00
🏗️ store plugin info as dataclass
This commit is contained in:
parent
f5b655ef71
commit
e0e23283c1
@ -5,6 +5,7 @@ import re
|
||||
import sys
|
||||
import pkgutil
|
||||
import importlib
|
||||
from dataclasses import dataclass
|
||||
from importlib._bootstrap import _load
|
||||
|
||||
from nonebot.log import logger
|
||||
@ -19,13 +20,11 @@ plugins: Dict[str, "Plugin"] = {}
|
||||
_tmp_matchers: Set[Type[Matcher]] = set()
|
||||
|
||||
|
||||
@dataclass(eq=False)
|
||||
class Plugin(object):
|
||||
|
||||
def __init__(self, name: str, module: ModuleType,
|
||||
matchers: Set[Type[Matcher]]):
|
||||
self.name = name
|
||||
self.module = module
|
||||
self.matchers = matchers
|
||||
name: str
|
||||
module: ModuleType
|
||||
matcher: Set[Type[Matcher]]
|
||||
|
||||
|
||||
def on(rule: Union[Rule, RuleChecker] = Rule(),
|
||||
|
Loading…
Reference in New Issue
Block a user