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,