✨ Compatible with pydantic 2.0 using the pydantic compatibility layer provided by nonebot

This commit is contained in:
HibiKier
2025-01-10 12:19:11 +08:00
committed by BalconyJH
parent 23ef00d01f
commit e814469b75
69 changed files with 178 additions and 147 deletions
@@ -100,4 +100,4 @@ async def _(
name=uname,
ava_url=AVA_URL.format(session.user.id),
)
await ws_conn.send_json(data.dict())
await ws_conn.send_json(data.to_dict())
@@ -107,7 +107,7 @@ class ApiDataSource:
"""
bot = nonebot.get_bot(bot_id)
friend_list, _ = await PlatformUtils.get_friend_list(bot)
fd = [x for x in friend_list if x == user_id]
fd = [x for x in friend_list if x.user_id == user_id]
if not fd:
return None
like_plugin_list = (
@@ -1,3 +1,4 @@
from nonebot.compat import model_dump
from pydantic import BaseModel
from zhenxun.utils.enum import RequestType
@@ -256,6 +257,9 @@ class Message(BaseModel):
ava_url: str
"""用户头像"""
def to_dict(self, **kwargs):
return model_dump(self, **kwargs)
class SendMessageParam(BaseModel):
"""