mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-09-06 20:16:47 +00:00
✨ Feature: 添加插件元信息定义 (#1046)
This commit is contained in:
@ -19,7 +19,7 @@ from typing import Set, Dict, List, Union, Iterable, Optional, Sequence
|
||||
from nonebot.log import logger
|
||||
from nonebot.utils import escape_tag
|
||||
|
||||
from .plugin import Plugin
|
||||
from .plugin import Plugin, PluginMetadata
|
||||
from . import (
|
||||
_managers,
|
||||
_new_plugin,
|
||||
@ -242,6 +242,10 @@ class PluginLoader(SourceFileLoader):
|
||||
# leave plugin context
|
||||
_current_plugin.reset(_plugin_token)
|
||||
|
||||
# get plugin metadata
|
||||
metadata: Optional[PluginMetadata] = getattr(module, "__plugin_meta__", None)
|
||||
plugin.metadata = metadata
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user