From dfd095e78394eb2a5dad7c15228e4acd162747cc Mon Sep 17 00:00:00 2001 From: adk23333 <2633103794@qq.com> Date: Wed, 20 Dec 2023 19:56:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0message=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=EF=BC=8C=E9=98=B2=E6=AD=A2=E8=84=91=E6=8A=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model.py => sio_model.py | 6 ++++++ 1 file changed, 6 insertions(+) rename model.py => sio_model.py (88%) diff --git a/model.py b/sio_model.py similarity index 88% rename from model.py rename to sio_model.py index 7c14479..f4ecebb 100644 --- a/model.py +++ b/sio_model.py @@ -37,6 +37,12 @@ class Message(Options): sticker: Optional[None] = None # 发送表情 message_type: Optional[str] = None # 消息类型 + @model_validator(mode='after') + def check_room_id(self): + if self.room_id is None and self.room is None: + raise ValueError('room id 和 room 二选一 ( 实际上直接填 room id 就行了 )') + return self + def to_json(self) -> dict: return { 'content': self.content,