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