添加message数据校验,防止脑抽
This commit is contained in:
parent
d51625aba2
commit
dfd095e783
@ -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,
|
Loading…
Reference in New Issue
Block a user