mirror of
https://github.com/TriM-Organization/LiteyukiBot-TriM.git
synced 2024-11-25 00:25:04 +08:00
49 lines
1.1 KiB
Python
49 lines
1.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""
|
|
Copyright (C) 2020-2024 LiteyukiStudio. All rights reserved
|
|
|
|
版权所有 © 2020-2024 神羽SnowyKami & 金羿Eilles with LiteyukiStudio & TriM Org.
|
|
保留所有权利
|
|
|
|
@Time : 2024/7/24 上午12:02
|
|
@Author : snowykami
|
|
@Email : snowykami@outlook.com
|
|
@File : model.py
|
|
@Software: PyCharm
|
|
"""
|
|
from types import ModuleType
|
|
from typing import Optional
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class PluginMetadata(BaseModel):
|
|
"""
|
|
轻雪插件元数据,由插件编写者提供
|
|
"""
|
|
name: str
|
|
description: str
|
|
usage: str = ""
|
|
type: str = ""
|
|
homepage: str = ""
|
|
running_in_main: bool = True # 是否在主进程运行
|
|
|
|
|
|
class Plugin(BaseModel):
|
|
"""
|
|
存储插件信息
|
|
"""
|
|
model_config = {
|
|
'arbitrary_types_allowed': True
|
|
}
|
|
name: str
|
|
"""插件名称 例如plugin_loader"""
|
|
module: ModuleType
|
|
"""插件模块对象"""
|
|
module_name: str
|
|
"""点分割模块路径 例如a.b.c"""
|
|
metadata: Optional[PluginMetadata] = None
|
|
|
|
def __hash__(self):
|
|
return hash(self.module_name)
|