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