mirror of
https://github.com/TriM-Organization/LiteyukiBot-TriM.git
synced 2024-11-11 01:27:29 +08:00
feat: pydantic v2 支持
fix: 自动更新后更新依赖
This commit is contained in:
parent
4d274df6b2
commit
d80c4a7c90
@ -293,6 +293,7 @@ async def _(bot: T_Bot):
|
||||
async def every_day_update():
|
||||
if get_config("auto_update", default=True):
|
||||
result, logs = update_liteyuki()
|
||||
pip.main(["install", "-r", "requirements.txt"])
|
||||
if result:
|
||||
await broadcast_to_superusers(f"Liteyuki updated: ```\n{logs}\n```")
|
||||
nonebot.logger.info(f"Liteyuki updated: {logs}")
|
||||
|
@ -12,7 +12,7 @@ from arclet.alconna import Arparma, Alconna, Args, Option, Subcommand
|
||||
|
||||
|
||||
class Node(LiteModel):
|
||||
TABLE_NAME = "node"
|
||||
TABLE_NAME: str = "node"
|
||||
bot_id: str = ""
|
||||
session_type: str = ""
|
||||
session_id: str = ""
|
||||
@ -22,7 +22,7 @@ class Node(LiteModel):
|
||||
|
||||
|
||||
class Push(LiteModel):
|
||||
TABLE_NAME = "push"
|
||||
TABLE_NAME: str = "push"
|
||||
source: Node = Node()
|
||||
target: Node = Node()
|
||||
inde: int = 0
|
||||
@ -106,9 +106,10 @@ async def _(event: T_MessageEvent, bot: T_Bot):
|
||||
for line in str(event.message).split("\n"):
|
||||
msg_formatted += f"**{line.strip()}**\n"
|
||||
push_message = (
|
||||
f"> From {event.sender.nickname}@{push.source.session_type}.{push.source.session_id}\n> Bot {bot.self_id}\n\n"
|
||||
f"{msg_formatted}")
|
||||
await md.send_md(push_message, bot2, message_type=push.target.session_type, session_id=push.target.session_id)
|
||||
f"> From {event.sender.nickname}@{push.source.session_type}.{push.source.session_id}\n> Bot {bot.self_id}\n\n"
|
||||
f"{msg_formatted}")
|
||||
await md.send_md(push_message, bot2, message_type=push.target.session_type,
|
||||
session_id=push.target.session_id)
|
||||
return
|
||||
|
||||
|
||||
@ -119,6 +120,6 @@ __plugin_meta__ = PluginMetadata(
|
||||
usage="",
|
||||
homepage="https://github.com/snowykami/LiteyukiBot",
|
||||
extra={
|
||||
"liteyuki": True,
|
||||
"liteyuki": True,
|
||||
}
|
||||
)
|
||||
|
@ -18,7 +18,7 @@ memory_database = {
|
||||
|
||||
|
||||
class User(LiteModel):
|
||||
TABLE_NAME = "user"
|
||||
TABLE_NAME:str = "user"
|
||||
user_id: str = Field(str(), alias="user_id")
|
||||
username: str = Field(str(), alias="username")
|
||||
profile: dict[str, str] = Field(dict(), alias="profile")
|
||||
@ -27,7 +27,7 @@ class User(LiteModel):
|
||||
|
||||
|
||||
class Group(LiteModel):
|
||||
TABLE_NAME = "group_chat"
|
||||
TABLE_NAME: str = "group_chat"
|
||||
# Group是一个关键字,所以这里用GroupChat
|
||||
group_id: str = Field(str(), alias="group_id")
|
||||
group_name: str = Field(str(), alias="group_name")
|
||||
@ -37,26 +37,26 @@ class Group(LiteModel):
|
||||
|
||||
|
||||
class InstalledPlugin(LiteModel):
|
||||
TABLE_NAME = "installed_plugin"
|
||||
TABLE_NAME: str = "installed_plugin"
|
||||
module_name: str = Field(str(), alias="module_name")
|
||||
version: str = Field(str(), alias="version")
|
||||
|
||||
|
||||
class GlobalPlugin(LiteModel):
|
||||
TABLE_NAME = "global_plugin"
|
||||
TABLE_NAME: str = "global_plugin"
|
||||
liteyuki: bool = Field(True, alias="liteyuki") # 是否为LiteYuki插件
|
||||
module_name: str = Field(str(), alias="module_name")
|
||||
enabled: bool = Field(True, alias="enabled")
|
||||
|
||||
|
||||
class StoredConfig(LiteModel):
|
||||
TABLE_NAME = "stored_config"
|
||||
TABLE_NAME :str= "stored_config"
|
||||
config: dict = {}
|
||||
|
||||
|
||||
class TempConfig(LiteModel):
|
||||
"""储存临时键值对的表"""
|
||||
TABLE_NAME = "temp_data"
|
||||
TABLE_NAME: str = "temp_data"
|
||||
data: dict = {}
|
||||
|
||||
|
||||
|
@ -14,7 +14,7 @@ packaging~=23.1
|
||||
playwright~=1.17.2
|
||||
psutil~=5.9.8
|
||||
py-cpuinfo~=9.0.0
|
||||
pydantic~=1.10.14
|
||||
pydantic~=2.7.0
|
||||
Pygments~=2.17.2
|
||||
pytz~=2024.1
|
||||
PyYAML~=6.0.1
|
||||
|
Loading…
Reference in New Issue
Block a user